function useCallbackRef() {
const [domElem, setDomElem] = React.useState(null);
function setElem(elem) {
if (elem) {
setDomElem(elem);
setDomElem.current = elem; // This is important , because might be some other component which will be needing
// access to the elem
}
}
return [domElem, setElem];
}
Created
December 25, 2019 15:59
-
-
Save simbathesailor/31602de84f48f0cb80ca4e23bf87eb86 to your computer and use it in GitHub Desktop.
blog11.md
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment