May 2019
Intermediate to advanced
496 pages
10h 38m
English
It's now time for some up-front design.
A Redux store is simply an object of data with some restrictions on how it is accessed. So, how do we expect our store data to look? Here's what we'll aim for. The object encodes all the information that CustomerForm already uses about a fetch request to save customer data:
{ addCustomer: { status: SUBMITTING | FAILED | VALIDATION_FAILED | SUCCESSFUL, // only present if the customer was saved successfully customer: { id: 123, firstName: 'Ashley' ... }, // only present if the server returned validation errors validationErrors: { phoneNumber: '...' }, // only present if the server returned an error other than validation error: true | false }}
We save the customer in the Redux ...
Read now
Unlock full access