title: React lazy recursive import
body: <p>I have requirement where I need to load component from dynamic folders. For example I have following folders inside components</p>
  <pre><code>components  
      -default
          -component-one
          -component-two
          -component-three
      -custom
          -component-three
  </code></pre>
  <p>Suppose if <code>componentFolder state</code> set to <code>custom</code> folder then it should load from <code>custom folder</code> .if any component not found in <code>custom folder</code> then it should be load from <code>default</code> folder.
  So my question is ,can we possible to import recursively ?</p>
  <pre><code> function App() {
   
  const [componentFolder, setComponentFolder] = React.useState(&quot;default&quot;)
  
  const Home = React.lazy(() =&gt; import(&quot;./components/&quot; +componentFolder+ &quot;/Home&quot;));
    return (
      &lt;div className=&quot;App&quot;&gt;
        &lt;Suspense fallback=&quot;laoding&quot;&gt;
          &lt;Home&gt;&lt;/Home&gt;
        
        &lt;/Suspense&gt;
  
      &lt;/div&gt;
    );
  }
  </code></pre>
  <p>the below link has same requirement as i asked
  <a href="https://stackoverflow.com/questions/48259512/how-to-check-if-a-pariticular-fileexists-in-reactjs/48264153">How to check if a pariticular fileExists in reactjs</a></p>