title: Redux. Pass state value to reducer
body: <p>I'm trying implement Redux to my app. So, I created action, reducer, store etc... and now I have to pass state to reducer and change value of this parameter (boolean). I don't know what I'm doing wrong. An <code>alert</code> in reducer is triggered after click button, but <code>dialog</code> doesn't close. Any idea how to change value of <code>open</code>?  </p>
  
  <p>Action</p>
  
  <pre><code>export const checkPassword = () =&gt; ({
      type: "CHECK_PASSWORD"
    });
  </code></pre>
  
  <p>Component</p>
  
  <pre><code>const mapDispatchToProps = dispatch =&gt; {
      return {
          checkPassword: () =&gt; dispatch({type: 'CHECK_PASSWORD'})
   };}
  
  function mapStateToProps(state, open) {
     return {
         open: state.open,
     };}
  
  class StartDialog extends Component {
    constructor(props) {
      super(props);
      this.state = { open: true };
    }
  
  render() {
  const actions = [ &lt;FlatButton label="Submit" onClick={this.props.checkPassword} /&gt; ];
  
  return (
    &lt;Dialog title="Welcome to the React App!" actions={actions} open={this.state.open} &gt;&lt;/Dialog&gt;
  );}}
  
  const StartForm = connect(mapStateToProps, mapDispatchToProps)(StartDialog);
  
  export default StartForm;
  </code></pre>
  
  <p>Reducer</p>
  
  <pre><code>import { CHECK_PASSWORD } from "../constants/action-types";
  
  const initialState = {
    open: true
  };
  
  const checkpasswordReducer = (state = initialState, action) =&gt; {
    switch (action.type) {
      case CHECK_PASSWORD:
      alert('action!')
      return {...state, open: false};
    default:
      return state;
  }};
  
  export default checkpasswordReducer;
  </code></pre>
  
  <p>Store</p>
  
  <pre><code>import { createStore } from "redux";
  import rootReducer from "../reducers/index";
  
  const store = createStore(
    rootReducer,
    window.__REDUX_DEVTOOLS_EXTENSION__ &amp;&amp; 
  window.__REDUX_DEVTOOLS_EXTENSION__()
  );
  
  export default store;
  </code></pre>
  
  <p>Reducer index.js</p>
  
  <pre><code>import { combineReducers } from "redux";
  import checkpasswordReducer from "./checkpasswordReducer";
  
  export default combineReducers({ checkPassword: checkpasswordReducer 
  });
  </code></pre>