REACT TOGGLE CLASS

  
// You Should pass props to main functions and import useState
const [isActive, setActive] = useState(false);
const toggleClass = () => {
    setActive(!isActive);
  };

<YouDiv ClassName="{isActive ? 'active': null}" onClick={toggleClass}>
 
</YouDiv>
M Hemel Hasan