I don't believe this is actually a bug. The problem is, ref is not actually defined when you pass it in, but since you're passing a reference that gets assigned, it actually gets assigned when the effect kicks off. The ref is undefined when you first pass it because the component has...
This is the first suggestion in that second error we got. It may seem a bit weird, but if you move the helper function within the useEffect hook, it’s no longer being redeclared with every component re-render. Instead, it’s only being redeclared every time the effect is re-run. And...