Use o estado no nome da classe
Standard fair:
const [toggleClass, setToggleClass] = useState(false)
return <div className={toggleClass ? 'some-class' : ''} />
Using template literals:
const [toggleClass, setToggleClass] = useState(false)
return <div className={`some-class ${toggleClass ? 'some-class' :''}`} />
syeddeveloper