re: Explain CSS BEM Structures Like I'm Five VIEW POST

TOP OF THREAD FULL DISCUSSION
re: In traditional webapps (i.e. webapps built before CSS encapsulation was invented), every CSS rule is shared by the entire app. This creates a few p...
 

Great explanation, thanks!
Just a question, from a readability point of view, you'd say that it is valid to use even in React or other frameworks?

 

That's a hard one. Last I checked, the "official" solution for styling React apps is CSS-in-JS, which uses the HTML style attribute, which makes BEM irrelevant. However, if you decide to style your app with traditional CSS files (or <style> tags), then yes, BEM is valid.

As far as other frameworks, it depends. Angular 2+ and Vue (with Single File Components) have CSS encapsulation, so BEM, while still valid, is probably solving a problem you don't have.

There are a few other good CSS architectures worth considering as well, like SMACSS and Atomic. And rolling your own is fine too.

code of conduct - report abuse