May 2019
Intermediate to advanced
496 pages
10h 38m
English
At the start of the chapter, we looked at how the purpose of this change was essentially a transplant of CustomerForm's doSave function into a Redux action. So, our code is to replace that call with a dispatch of an ADD_CUSTOMER_REQUEST action to the Redux store.
The trickiest part of this is how we deal with submission errors. In the existing code, any errors that were caught in doSave were directly saved to the component state, which would then cause the component to re-render. With our new Redux setup, that component state has been promoted to props. A re-render still occurs, but it's done indirectly. Say, for example, a server ...
Read now
Unlock full access