useEffect cheat sheet
2021-09-07
React Native
自分用のメモ
useEffect(() => {
/* This will run once, after the component mounts */
}, [])
useEffect(() => {
/* This will run once, after component update */
/* This can either by change in props or state */
})
useEffect(() => {
/* This will run once, after the component mounts */
return () => {
/* This will run only after the component unmounts */
}
}, [])
useEffect(() => {
/* This will run once, after the component mounts,
and every time some dependencies changes */
/* dependencies may be some props or state */
}, [dependencies])