title: What is the benefit of using redux?
body: <p>I am thinking about learning reactjs recently and I hope if someone could help me to understand the circumstances to use redux, as I am confused by its complicated logic. </p>
  
  <p>First, I have used angular2+ for a while, and so I am also trying to grab the idea from the what I have already know.</p>
  
  <p>I have seen many examples of redux but I don't understand the benefit to use actions and dispatch.</p>
  
  <p>What is the benefit of using redux store using actions and reducers instead of just use class and subject like this?</p>
  
  <pre><code>class Store{
      subject = new BehaviorSubject(0);
      get value(){
          return this.subject.getValue();
      }
      inc(){
          this.subject.next(this.subject.value+1);
      }
      dec(){
          this.subject.next(this.subject.value-1);
      }
      clear(){
          this.subject.next(0);
      }
  }
  
  class Demo extends React.Component&lt;{}, {}&gt;{
      store = new Store();
      componentWillMount(){
          this.store.subject.subscribe(_ =&gt; this.forceUpdate())
      }
      render(){
          const value = this.store.value;
          const { inc, dec, clear } = this.store;
          const store = this.store;
          return (
              &lt;div&gt;
                  &lt;span&gt;{`current value is ${value}`}&lt;/span&gt;
                  &lt;button onClick={inc.bind(store)}&gt;INC&lt;/button&gt;
                  &lt;button onClick={dec.bind(store)}&gt;DEC&lt;/button&gt;
                  &lt;button onClick={clear.bind(store)}&gt;CLEAR&lt;/button&gt;
              &lt;/div&gt;
          );
      }
  }
  </code></pre>