Styling React Apps
className and style, CSS Modules, Tailwind, CSS-in-JS, component libraries and headless UI, and animation that respects reduced motion.
React draws the page, but it has no opinion about how the page looks. It hands you two props, className and style, and leaves the rest to CSS. That freedom is why the React world has so many styling approaches: plain global stylesheets, CSS Modules, Tailwind utility classes, CSS-in-JS libraries, and ready-made component libraries. Each one answers the same questions differently: how do I stop one component's CSS from breaking another's, how do I change styles from state and props, and how much work does the browser do at runtime?
In this phase you'll learn each approach from the inside. You'll write a tiny clsx, simulate how a bundler turns .card into _card_x7f2a_1, build the cn() helper every Tailwind project uses, write a miniature styled() with useInsertionEffect to see exactly what runtime CSS-in-JS costs and why it clashes with Server Components, and compare MUI and Chakra with headless libraries such as Radix, React Aria and the copy-in components of shadcn/ui.
The last topic makes things move: CSS transitions driven by state, exit animations that keep an element mounted until it has faded out, the browser's View Transitions API with flushSync, the Motion library, and prefers-reduced-motion so movement never makes anyone feel ill. The CSS course (/css) teaches CSS itself; this phase is about how React and CSS fit together.
Practise this phase
Hands-on exercises: write the code, see your page live, and press Check to have it tested automatically.