why is that when we declare a object outside the render function and using it in the return of the render function of a component causes an unexpected token error . If i declare the myStyle object inside the render function the below code works correctly.
import React , { Component } from 'react';
class Test extends Component {
  var myStyle={
      backgroundColor:"red",
      width:"100px",
      height:"100px",
      margin:"0 auto",
      marginTop:"50px"
  };
  render(){
    return(
       <div style={myStyle}>
      </div>
    );
  }
}
export default Test;
Thanks