title: React Native: Passing Ref from Parent to Child in React Hooks
body: <p>Have tried a few different approaches and can't figure out the exact syntax to pass a ref from the parent to the child. Ultimately I'm trying to make it so that I can scroll to beginning onPress of a Child component. Can someone help me figure it out?</p>
  
  <p>Getting error: `scrollViewRef.scrollTo is not a function'</p>
  
  <pre><code>import React, { useRef } from 'react';
  import { ScrollView, Button } from 'react-native';
  
  const Parent = () =&gt; {
  
    const scrollViewRef = useRef();
  
    const scrollToBeginning = () =&gt; {
      scrollViewRef.scrollTo({ x: 0, animated: true });
    }
  
    return (
      &lt;ScrollView
        ref={ scrollViewRef }
        pagingEnabled
        snapToInterval={ width }
        horizontal
        scrollEventThrottle={16}
        scrollEnabled={ true }
      &gt;
        &lt;Child
          scrollToBeginning={ scrollToBeginning }
        &gt;
      &lt;/ScrollView&gt;
    )
  }
  
  
  const Child = (props) =&gt; {
    return (
      &lt;Button onPress={ props.scrollToBeginning } title="Scroll To Beginning" /&gt;
    )
  }
  </code></pre>