title: Use closure for global component setting in ReactJS
body: <p>A higher order component with context would probably be the best solution here, but using closure for global component setting seems like the best second option and shouldn't break in the future like the React doc site says context might.</p>
  
  <p>Whether components update if the path changes doesn't matter. This is the path to the icons or assets provided by another library, so we don't need any components to re-render. This is a UI library not an application, so I have / it has no control over the URLs to the consuming applications. It could be a prop and <code>path</code> is already a prop for <code>Icon</code> at this time, but <code>Icon</code> is used across 10 other parent components that probably shouldn't have an <code>iconPath</code> prop added to them. </p>
  
  <pre><code>import Icon from 'my-ui-library/components/icon'
  Icon.setStaticGlobalPath('/assets/icons')
  </code></pre>
  
  <p>And then within <code>Icon</code> but outside of the <code>Class</code>, you'd have a variable that can be modified by the <code>setStaticGlobalPath</code>.</p>
  
  <p>Is using closure for a global component setting in ReactJS a bad idea? What are the drawbacks?</p>