title: Validating Data in Redux Store
body: <p>I am trying to validate data in a redux store for a form. What is the best way to go about this. I have had a few ideas so far:</p>
  
  <ol>
  <li><p>A validate action has to be bound to some sort of listener like onBlur or onChange. Once a form component blurs it is then validated. However, the validate function then can 1) only validate that field in isolation or 2) must be passed the full form state. Also, action creators cannot/should not have access to the new state, so I can only update existing data, and I cannot bind the validators to something that updates the state. One upside, is that I can perform asynchronous validation by calling a validator action creator, and returning a promise (using redux-promise/thunk). </p></li>
  <li><p>Reducer validates it own data. Part 1 of the reduce would update the data, and Part 2 would analyze the state and update the errors. However, this goes against reducer purity, as updating one part of the state then updates another part the state. So I have to ensure the validator runs after the state is updated. </p></li>
  <li><p>Use selectors to derive errors from state. The data itself does not change if its invalid/valid, just errors are shown. However, since selectors are synchronous, I cannot do any asynchronous validation. </p></li>
  </ol>