Usar Efffect se desmontará
useEffect(() => {
return () => {
console.log("cleaning up --> unmount ");
};
}, []);
Victorious Vulture
useEffect(() => {
return () => {
console.log("cleaning up --> unmount ");
};
}, []);
useEffect(() => {
return () => {
console.log("cleaned up");
};
}, []);
useEffect( () => console.log("mount"), [] );
useEffect( () => console.log("will update data1"), [ data1 ] );
useEffect( () => console.log("will update any") );
useEffect( () => () => console.log("will update data1 or unmount"), [ data1 ] );
useEffect( () => () => console.log("unmount"), [] );
useEffect(() => {
//your code goes here
return () => {
//your cleanup code codes here
};
},[]);
import React, { useEffect } from 'react';
export const App: React.FC = () => {
useEffect(() => {
}, [/*Here can enter some value to call again the content inside useEffect*/])
return (
<div>Use Effect!</div>
);
}