Last active
November 28, 2021 08:02
-
-
Save jacobdo2/512e40e155fd64777e989dcfb3efc249 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function Child({ name, shouldScrollTo }) { | |
const ref = useRef() | |
useEffect(() => { | |
shouldScrollTo && ref.current.scrollIntoView({behavior: "smooth"}); | |
}, []); | |
return <div ref={ref}>{name}</div>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment