You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, would you accept pull requests to update your example?
I've been using your concept for my own site, but the immutability helpers and jquery are unnecessary dependencies:
The jquery ($.isEmptyObject(this.state.validationErrors) in CreateAccount.js can be replaced with (Object.keys(this.state.validationErrors).length > 0)
And if using react with es6 making state updates immutable can be done by utilising arrow functions:
And FWIW, to answer the concern of nested state (and so the use of immutability helpers) my implementation includes nested state, which I am updating as follows:
As an enhancement, I would also propose showing errors for a field after the field is changed rather than waiting for submit to be pressed. ie give user early feedback. Better still after it is "touched" by hooking into the blur event of the field.
Hi, would you accept pull requests to update your example?
I've been using your concept for my own site, but the immutability helpers and jquery are unnecessary dependencies:
The jquery ($.isEmptyObject(this.state.validationErrors) in CreateAccount.js can be replaced with (Object.keys(this.state.validationErrors).length > 0)
And if using react with es6 making state updates immutable can be done by utilising arrow functions:
this.setState(prevState => ({
...prevState,
newState
});
Happy to make those changes and submit a pull request if you're happy to accept them.
Thanks,
Al
The text was updated successfully, but these errors were encountered: