4. Styling in React

For generations, mankind (and probably really smart dolphins) have styled their HTML content using CSS (aka Cascading Style Sheets). Things were good. With CSS, you had a good separation between the content and the presentation. The selector syntax gave you a lot of flexibility in choosing which elements to style and which ones to skip. You couldn’t even find too many issues to hate about the whole cascading thing that CSS is all about.

Well, don’t tell React that. While React doesn’t actively hate CSS, it has a different view when it comes to styling content. As we’ve seen so far, one of React’s core ideas is to have our app’s visual pieces be self-contained and reusable. That is why the HTML elements and the JavaScript that ...

Get Learning React now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.