React Conditional className
Using Logical && operator
const MenuItem = ({ children }) => { return ( <li className={`menu-item ${isActive && 'menu-item-active'}`}> {children} </li> ); };
Using Ternary operator
const MenuItem = ({ children }) => { return ( <li className={`menu-item ${isActive ? 'menu-item-active' : ''}`}> {children} </li> ); };
References
https://dev.to/victorocna/better-conditional-css-classes-in-react-2p8h