Conditional CSS in React
Toggle classes from state: className={ok ? 'alert ok' : 'alert bad'}. Or template strings: `btn ${active ? 'btn-on' : ''}`. Libraries: clsx, classnames. Prefer classes over swapping ten inline colors — CSS can animate and theme them.
Conditional CSS in React — ok false → alert bad + Failed. Class changes with state.
Exam tip
className ternary from state.