title: React - cannot read property 'myFunction' of undefined
body: <p>I am trying to define a function in my component that will redirect the window to a new URL</p>
  
  <pre><code>class MyComponent extends Component {
  
   setWindowLocation = function(e)
   {
      window.location = e;
   }
  
   handleClick = function(eventKey){
      setWindowLocation("https://google.com") 
   }
  
   render() {
      ...
   }
  }
  </code></pre>
  
  <p>This compiles fine and doesn't throw an error, yet when i click the button that calls 'handleClick' my console window shows:</p>
  
  <blockquote>
  <pre><code>Uncaught TypeError: Cannot read property 'setWindowLocation' of undefined
  </code></pre>
  </blockquote>
  
  <p>Any idea?</p>