title: Can react hooks be used to inject components?
body: <p>Well consider I have a set of components, these components all have some basic fields. An example may be a pop up that shows in case of an erroneous state.</p>
  
  <p>This leads to something like:</p>
  
  <pre><code>function MyComponent(props) {
      const [showErr, setShowErr] = React.useState(false);
      const [errMsg, setErrMsg] = React.useState('');
      return &lt;&gt;
          &lt;...&gt;
          &lt;SomePopup
              open={showErr}
              errMsg={errMsg}
          /&gt;
      &lt;/&gt;
  }
  </code></pre>
  
  <p>While this is trivial the settings might not be in case of more complex interactions with the rest of the component isn't. It's also unnecessary boilerplate and violates DRY.</p>
  
  <p>The states can of course be combined in a custom hook <code>useError</code> (or in this trivial case in a single state). However can I also make it so that whenever I declare an object to have <code>useError</code>, it also has the component set up?</p>
  
  <p>That way I could prevent erros like "forgetting the popup" and "forgetting to set useError state" - DRY errors.</p>