Skip to content

Instantly share code, notes, and snippets.

@fabiancook
Created May 9, 2019 08:36
Show Gist options
  • Save fabiancook/f5e838023abaafb0e077677bac2a19d4 to your computer and use it in GitHub Desktop.
Save fabiancook/f5e838023abaafb0e077677bac2a19d4 to your computer and use it in GitHub Desktop.
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