22 ms·
HTML is for styling. JSON is for content. If you've heard "separate content from presentation" all your career, you might autonomically hear it as "separate HT
by jpochtar 7y ago
HTML is for styling. JSON is for content.
If you've heard "separate content from presentation" all your career, you might autonomically hear it as "separate HTML from CSS". I used to.
In a React app world, your content hasn't lived in HTML for a long time. It lives in your DB, and comes to you through JSON.
Your React codebase exists to style that JSON. That includes "HTML" (JSX), CSS, and whatever else you've got in there.
Since your HTML is for styling, and your CSS if for styling, why separate them? If you do, you're not separating content from presentation, you're separating presentation from presentation, and that's just wasteful.
Personally, I'd prefer to use inline styles for everything, though of course will use CSS for :hover of @media queries where I have to.