Skip to content

Instantly share code, notes, and snippets.



Created Aug 29, 2019
What would you like to do?
[Request for comment] Is there any potential issues handling componentDidMount and componentDidUp with useHooks in this manner?
const once = useRef(false)
useEffect(() => {
if(once.current === false){
once.current = true
// do things as were in componentDidMount
// do things as were in componentDidUpdate
// clean up
return () => {
}) // <- no need to pass in 2nd argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment