tezvyn:

CSS Custom Properties vs JS Theme Object in React

Source: developer.mozilla.orgadvanced

Tests render overhead vs CSS cascade. Strong answers: CSS variables update styles without re-renders, while JS theme objects in Context force subtree re-renders. Mention scoping, SSR FOUC, and setProperty interop.

Tests whether you separate style state from React component state. A strong answer explains that CSS variables update the DOM without triggering re-renders, whereas a JS theme object in Context forces every consumer to re-render on change. It should cover cascade scoping for nested themes, SSR FOUC mitigation, imperative setProperty for dynamic values, and CSS transitions on variables. Red flag: asserting that CSS variables work inside media query expressions or replace all JS-driven layout logic.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

CSS Custom Properties vs JS Theme Object in React · Tezvyn