title: Why does state object exist in React?
body: <p>I have experience with Angular and Vue and am beginning to learn React.</p>
  
  <p>Why are all variables that aren't passed from a parent component stored in the state object instead of at the root of the class? Also, why does React require a special method (setState) to change the value of a variable? Variable values can be changed directly, but unless setState is used, the view won't update.</p>
  
  <p>In Angular:</p>
  
  <pre><code>this.variableName = 'new value';
  </code></pre>
  
  <p>In React:</p>
  
  <pre><code>this.setState({
    variableName: 'new value'
  });
  </code></pre>