-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Mastering React Test-Driven Development
By :

The saga and reducer are now complete and ready to be used in the CustomerForm
React component. In this section, we’ll replace the use of doSave
, and then as a final flourish, we’ll push our React Router navigation into the saga, removing the onSave
callback from App
.
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.
With our new Redux setup, we used component state to display a submitting indicator and show any validation errors. That information is now stored within the Redux store, not component state. So, in addition to dispatching an action to replace doSave
, the component also needs to read state from the store. The component state variables can be deleted.
This has a knock-on effect on our tests. Since the saga tests the failure modes, our component...