Skip to content

Instantly share code, notes, and snippets.

@aurimasmi
Created July 20, 2020 07:37
Show Gist options
  • Save aurimasmi/804151b000ed60676148c17e9f180370 to your computer and use it in GitHub Desktop.
Save aurimasmi/804151b000ed60676148c17e9f180370 to your computer and use it in GitHub Desktop.
const [myRef, setRef] = useState(null);
const onRef = useCallback(ref => {
if (ref.current) {
setRef(ref);
}
});
return (
<View ref={onRef} />
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment