I am trying to figure out how to toggle an active class onClick to change CSS properties.
onClick
I have taken many approaches, and read many SO answers. Using
You can also do this with hooks.
function MyComponent (props) { const [isActive, setActive] = useState(false); const toggleClass = () => { setActive(!isActive); }; return ( {props.text} ); }
{props.text}