Created
May 9, 2019 08:36
-
-
Save fabiancook/f5e838023abaafb0e077677bac2a19d4 to your computer and use it in GitHub Desktop.
This file contains 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
import { useRef } from "react"; | |
export default function useAfterRender(fn) { | |
const value = {}; | |
const ref = useRef(value); | |
if (ref.current === value) { | |
return; | |
} | |
return fn(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment