title: How to pass state from hook to display in App hook in React?
body: <p>How do I send the state(data) of <code>info</code> to the App hook, so that I can display the properties in divs? <code>setInfo(info)</code> stores the data I want to display on the Map hook and I can see all the properties when I <code>console.log(info)</code> in <code>_onClick</code>. I am stuck on how to use and show it in App. Thanks for the help.</p>
  
  <p><strong>App</strong></p>
  
  <pre><code>const App = () =&gt; {
  
    return (
      &lt;div className="App"&gt;
        &lt;div className="inner-left map-container"&gt;
          &lt;Map /&gt;
        &lt;/div&gt;
        &lt;div className="inner-right info-container"&gt;
          &lt;Nav /&gt;
          &lt;Search /&gt;
          &lt;div id="info_side"&gt;
            {info} // throws an error undefined
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    );
  }
  
  export default App;
  </code></pre>
  
  <p><strong>Map</strong></p>
  
  <pre><code>const Map = () =&gt; {
      ...
      const [info, setInfo] = useState(null)
  
      ...
  
      const _onClick = event =&gt; {
          const { features } = event;
          const info = features &amp;&amp; features.find(f =&gt; f.layer.id === 'icon');
          setInfo(info); // This is what I would like to use in App
      }
  
      return (
          &lt;ReactMapGL
              {...viewport}
              onViewportChange={_updateViewport}
              width="100%"
              height="100%"
              mapStyle={mapStyle}
              mapboxApiAccessToken={TOKEN}
              onHover={_onHover}
              onClick={_onClick}&gt;
  
              &lt;Source id="my-data" type="geojson" data={geojson}&gt;
                  &lt;Layer {...icon} /&gt;
              &lt;/Source&gt;
  
              &lt;div style={navStyle}&gt;
                  &lt;NavigationControl onViewportChange={_updateViewport} /&gt;
                  ...
              &lt;/div&gt;
          &lt;/ReactMapGL&gt;
      );
  }
  
  export default Map;
  </code></pre>