title: Pass dynamic value to HOC in react
body: <p>I write some HOC and I need to pass to this HOC a dynamic object that I create on some life cycle level and I did not get him as a prop.
  If I try to pass some static value ( for example initialize myObj from start) it works as expected and I get the correct value.</p>
  
  <p>Let's say this is my component class :</p>
  
  <pre><code> let myObj = {};
  
    class Test extends React.Component
     {
        constructor(props) {
          super(props);
          .....
          }
  
           render() {
              myObj = {test:'test'};
              return ( ... )
          }       
      }
     export default withHOC(Test, myObj);
  </code></pre>
  
  <p>And this is my HOC:</p>
  
  <pre><code>const withHOC = (Component, test) =&gt; {
      class Hoc extends React.Component
      {
          constructor(props)
          {
              super(props);
              const s = test; // ----&gt;test is empty object always !!
              ...
          }
  
       } 
       return Hoc;
   }
  </code></pre>
  
  <p>My 'Dynamic' object that I create on my 'test' class is always empty on my HOC class.
  It's happend also when I try to pass some value from my props directly, in this case the page is stuck(without errors in console).</p>
  
  <p>Does someone have any idea how to resolve that? Thanks!</p>