score:1

Accepted answer
useEffect(() => {    
  if (mounted)
    setMounted(false);
  else
    setMounted(true);
},[]);

Related Query

More Query from same tag