title: Use callback definition of a functional component outside the component
body: <p>I got a React functional Component with a callback inside. I want to define a struct outside the Component with a field which holds a reference to the callback, but not just the first definition it got, but it should hold every time the latest rendering of that callback to avoid closure issues.</p>
  <p>psuedo code of what I mean:</p>
  <pre><code>let someStruct = {
    field: MyComponent.callback
  }
  
  const MyComponent = props =&gt; {
    const callback = () =&gt; { ...some code that depends on the state of MyComponent }
  }
  </code></pre>
  <p>How can I do it? And again considering closure, I need the latest callback with the correct data it uses.</p>