Last active
August 12, 2019 15:01
-
-
Save ellemedit/f8a65f03e724d08b0633cf4c8e36922f to your computer and use it in GitHub Desktop.
skipping to update state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
React.useEffect(() => { | |
let canceled = false; | |
axios.post().then((res) => { | |
if (canceled) { | |
return; | |
} | |
setState(res.data); | |
}); | |
return () => { | |
canceled = true; | |
}; | |
}, [status]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment