Comparation
Class Component
Function Component
useEffect(() => {
// Your code here
}, []);useEffect(() => {
// Your code here
}, [yourDependency]);useEffect(() => {
// componentWillUnmount
return () => {
// Your code here
}
}, [yourDependency]);Last updated