Hacker News new | past | comments | ask | show | jobs | submit login

You can do this with CSS Modules using BEM Classnames and a function to generate BEM classnames given a Component Name and State/Props.

The function can then pick the generated classes out of the CSS Module's JSON import. If the classname doesn't exist, it can warn to the console.

It's farely straight forward in React. You just need to make sure you always use the function to provide values to the className prop instead of manual strings.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: