Usar efecto con limpieza
useEffect(() => {
//your code goes here
return () => {
//your cleanup code codes here
};
},[]);
Tense Trout
useEffect(() => {
//your code goes here
return () => {
//your cleanup code codes here
};
},[]);