title: init state without constructor in react
body: <pre><code>import React, { Component } from 'react';
  
  class Counter extends Component {
    state = { value: 0 };
  
    increment = () =&gt; {
      this.setState(prevState =&gt; ({
        value: prevState.value + 1
      }));
    };
  
    decrement = () =&gt; {
      this.setState(prevState =&gt; ({
        value: prevState.value - 1
      }));
    };
  
    render() {
      return (
        &lt;div&gt;
          {this.state.value}
          &lt;button onClick={this.increment}&gt;+&lt;/button&gt;
          &lt;button onClick={this.decrement}&gt;-&lt;/button&gt;
        &lt;/div&gt;
      )
    }
  }
  </code></pre>
  
  <p>Usually what I saw is people do this.state within the constructor function if he used es6 class. If he isn't he probably put the state using getinitialstate function. But above code (yes it's a working code), did not used either both. I have 2 question, what is state here? is that a local variable? if yes why it has no <code>const</code>? where does the prevState come from? why arrow function is used in setState? isn't it's easy to just do <code>this.setState({value:'something'})</code>?</p>