title: Redux : store.getState return undefined value
body: <p>Why my store.getState return undefined value!  I'm quite new with ReactJS &amp; Redux here my code</p>
  
  <pre><code>import {createStore} from 'redux';
  
  const initialState = {
  salary: 1000,
  }
  
  const reducer = (state=initialState, action) =&gt; {
  switch (action.type) {
      case "ADD":
          state = {
              salary: state.salary+=action.payload,
          }
          break;
  
      default:
          break;
  }
  }
  
  const store = createStore(reducer);
  
  store.subscribe(() =&gt; {
  console.log('Update salary: ', store.getState.salary);
  })
  
  store.dispatch({
  type: "ADD",
  payload: 2000,
  });
  </code></pre>
  
  <p>Console : Update salary:  – undefined</p>
  
  <p>Thank you.</p>