Redux form successful async validation -
redux form async validation quite nice, want somehow indicate asynchronous validation has succeeded. want:
- field empty, don't show async success
- field getting filled, normal sync validation happening, don't show async success
- field loses focus, async validation starts, don't show async success
- a) async validation returns error, show it
- b) async validation succeeds, show async success
however have asyncvalidating
prop, , can't change local state in render
method. dispatch redux action , keep every field async success state, use redux-form avoid managing form state myself.
i've hacked a little example here, passing "true" error value , showing "success" message when async validation passes.
ah, missed this one.
const usernamehasvalidated = username.touched && // field has been visited , blurred username.valid && // field has no error !asyncvalidating; // not validating
works fine.
Comments
Post a Comment