title: How to create window event listener in react component?
body: <p>I have a simple react component for my app, I would like to add resize function using window add event listener</p>
  
  <p>Here is my solution</p>
  
  <pre><code>import React, { Component } from 'react';
  
  class thankyoupayment extends Component {
  
      const resizeWindow = () =&gt;{
          console.log('Resize me');
      }
  
      componentDidMount() {
          window.addEventListener('resize', this.resizeWindow);
       }
  
      render() {
          return (
              &lt;VideoContainer&gt;
                      &lt;video&gt;&lt;/video&gt;
              &lt;/VideoContainer&gt;
          );
      }
  }
  
  const VideoContainer =styled.div`
          display: flex;
          justify-content: center;
  `
  </code></pre>
  
  <p>Unfortunately when I run I am gettin the following error </p>
  
  <pre><code>Unexpected token (8:10)
  </code></pre>
  
  <p>What do I need to change to solve the problem? React Newbie as hell</p>