Skip to content

Instantly share code, notes, and snippets.

@amirrezaDev1378
Created September 3, 2022 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirrezaDev1378/0dc4a8e24b1dfcb790607167d9fd0ae8 to your computer and use it in GitHub Desktop.
Save amirrezaDev1378/0dc4a8e24b1dfcb790607167d9fd0ae8 to your computer and use it in GitHub Desktop.
useEffect(() => {
let isUnmounted = false;
someAsyncOperation().then(data => {
if (!isUnmounted )
{
setState(data)
}
})
return () => { isUnmounted = true};
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment