Q:

Is it correct to define the state as a variable (or property) inside a class?

I found in an open source project a class like this
class ComponentName extends React.Component{
  state = {
    somestate here
  };

  render() {
    return <RenderedComponent value={somethings}>{some other things}</RenderedComponent>;
  }
}

is it correct to define state in this way? Shouldn't it be defined inside the class's constructor?

A:

You don't always have to define a constructor for every class. So if you don't need to define a constructor it is fine to use the state this way.

