Re:State of React and CSS
by abritinthebay on Tuesday April 05, 2016 @02:11AM
(#11428209)
> if your app is rendered by JS
only if it's pure browser-side only. Which is fine I guess - at that point you've given up on rendering performance anyhow generally (especially in initial paint).
How about server-side rendering?
Re:State of React and CSS
by abritinthebay on Tuesday April 05, 2016 @01:30PM
(#11432434)
Well that that point it's slower to paint with CSS-in-JS because the browser won't have the CSS until the very last thing (after asset load, after initial paint, after content load, then after script execution).
Now you could extract the CSS with a build step... but at that point you've admitted the solution is poor (and/or you're not good at CSS) and are just mitigating it by producing real CSS by automation.
That's fine, but it's no replacement for general good practice or domain knowledge.
If your app is rendered via JS, having the CSS loaded at runtime should not matter: there's no markup to affect (repaint) and the CSS will be available before your React/etc components are rendered up.