Normalizing the Data
Let’s have a look at how we can use the `normalizr` library to normalize the data.
We'll cover the following...
With the reducers updated and the action structure defined, we are left to extract the payload from the denormalized data we got from the server.
A simple approach might have a custom function that knows each API’s shape and normalizes the returned nested JSON into a flat structure with custom code.
Since this is quite a common practice, the normalizr
library can replace custom code. We can define the schema of the data coming from the server and have the normalizr
...