title: Using checkbox with Redux
body: <p>I'm having problems with a checkbox in my code in two areas, The first one, in my reducer, I want to see if the current state of the checkbox is <code>"true"</code> or <code>"false"</code> but I keep getting syntax errors on the if.</p>
  
  <pre><code>const initialState = {
    viewCheckbox: false
  }
  export default (state = initialState, action) =&gt; {
      switch (action.type){
          case 'VIEW_CHECKBOX':
              return {
                  ...state
                  if (viewCheckbox == false) {
                      viewCheckbox: true
                  } else {
                      viewCheckbox: false
                  }
              }
          default:
              return: state
      }
  }
  </code></pre>
  
  <p>My second problem is with the <code>mapDispatchToProps</code>, I'm using a table to create multiple checkboxes and I want to be able to differentiate each one of them by <strong>ID</strong>, and when I do it like this, it checks every checkbox on the table.</p>
  
  <pre><code>const mapDispatchToProps = (dispatch) =&gt; ({
      handleViewCheckbox: id =&gt; ev =&gt; {
        dispatch(viewCheckboxSubmit(id, ev.target.checked))
      }
  })
  </code></pre>
  
  <p>And when I create the checkbox I do it like this:</p>
  
  <pre><code>&lt;FormControlLabel
      control={
          &lt;Checkbox
              checked={checkedView}
              onChange={handleViewCheckbox(n.id,checkedView)}
           /&gt;
       }
       label='See'
  /&gt;
  </code></pre>