createEntityAdapter

So far we have been coding our reducer functions manually.

createEntityAdapter() automatically generates some helpful reducer functions (ie. CRUD operations) for us.

It normalizes the state into the form {ids: [], entities: {}}, where 'ids' stores the ids of the records/entities, and 'entities' maps each id to its corresponding record/entity.

If updateMany() is called repeatedly to the same ID, they will be merged into a single update, with later updates overwriting the earlier ones.
For both updateOne() and updateMany(), changing the ID of one existing entity to match the ID of a second existing entity will cause the first to replace the second completely.

The available adapter functions are: