title: Integrating web3 from Metamask in React
body: <p>I am new to ReactJS. 
  Seem to be having trouble integrating web3 from Metamask in React.
  Metamask version: web3@1.0.0-beta.34</p>
  
  <pre><code>import Web3 from 'web3'
  
  let web3;
  
  window.addEventListener('load', function () {
      if (typeof window.web3 !== 'undefined') {        
          web3 = new Web3(window.web3.currentProvider);
      } else {
          // No web 3 provider
          console.log("Please install Metamask");
      }    
  });
  
  export default web3;
  </code></pre>
  
  <p>Getting the following error:</p>
  
  <pre><code>window is not defined
  ReferenceError: window is not defined
      at Object../lib/getWeb3.js (lib/getWeb3.js:5:0)
  </code></pre>