title: Check if folder exists in renderer process using Electron, React
body: <p>I cannot seem to require it properly from the renderer process.</p>
  
  <p>this is not working:</p>
  
  <p><code>const fs = window.require('fs').remote</code></p>
  
  <p>this is not working</p>
  
  <p><code>const fs = remote.require('fs')</code></p>
  
  <p>the function that uses it is like (using TypeScript):</p>
  
  <pre><code>private checkFolder = () =&gt; {
    fs.stat(this.state.targetLocationPath!, (err: any, stats: fs.Stats) =&gt; {
     console.log('stats', stats)
     this.setState({ isCreateButtonDisabled: !stats.isDirectory })
    })
  }
  </code></pre>