Form validation with AngularJs and Redux — Medium

  • Finally we can append all the forms we want, all are totally isolated.
  • We have a simple page with a form witch receive an email in order to subscribe to a list.
  • const SignListByIdReducer = (state = { }, action) => { switch (action.type) { case actions.SUBMIT_EMAIL: return Object.assign({}, state, { [action.id]: { id: action.id, email: action.email, list: action.list, loading: true, errors: [], } }); case actions.EMAIL_ADDED: return Object.assign({}, state, { [action.id]: Object.assign({}, state[action.id], { loading: false, errors: [], }), }); case actions.FAIL_TO_ADD: return Object.assign({}, state, { [action.id]: Object.assign({}, state[action.id], { loading: false, errors: action.errors, }), }); default: return state; } };

Read the full article, click here.


@esion: “form validation with #angularjs and #redux:”


[TL;DR]: All depends on the shape of the state.


Form validation with AngularJs and Redux — Medium

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.