1×
Become a member
to unlock all features

Create egghead account to access 5000+ tutorials and resources from expert developers.

Create account
Autoplay

    Manage React component classes with classnames npm package

    reactReact

    When developing React apps it's common that we have components that need to have different classes depending on different conditions. In such complex scenarios, we often end up with a whole lot of if statements (or switches) just to set proper CSS classes to a component.

    Luckily, there is a utility npm package to help us with that - classnames. In this lesson, we are going to learn how to use classnames package to manage setting different classes to a Message component in an easy and maintainable way.