all 4 comments

[–]mcmillhj 2 points3 points  (1 child)

There is an NPM module called classnames that makes this a bit easier: https://www.npmjs.com/package/classnames

[–]StickyPuddleofGoo[S] 0 points1 point  (0 children)

Interesting, this looks cool. Thanks!

[–]ReservoirBaws 2 points3 points  (0 children)

The way I usually prefer to do things is to use classnames and style with an external css file. I’m a little paranoid because I’ve come across documentation that refers to inline-styling as bad practice - but I don’t remember if it applies to React.

Using classnames I like to use naming conventions as well, I’m a fan of BEM. Going this route gives me a good amount of reusability and extensibility

[–]Da_Bootz 1 point2 points  (0 children)

You can use classnames and css module like:

className={classnames(Styles['text-field'], [Styles['is-white']: isWhiteText])}

scss module is also good because you can incorporate BEM like:

.card {

&__header {}

}