...

/

Adding Entity CRUD Reducers

Adding Entity CRUD Reducers

We'll cover the following...

In Form Change Handling, Data Editing, and Feature Reducers, we used a custom FormEditWrapper component to buffer form change events, wrote custom reducer logic for the “editing” feature, and added basic editing for Pilot entries. In this section, we’ll add the ability to delete Pilots, use generic entity reducer logic to implement “draft data” handling for forms, and implement form resetting and cancelation..

Thus far, we can load a list of Pilots from our fake API, display them in the UI, and edit the details of an individual pilot. That covers two of the four capabilities in the term “CRUD” (“Create”, “Retrieve”, “Update”, and “Delete”). Let’s go ahead and add more reducer CRUD logic for other cases.

Creating a Redux-ORM Session Selector

We’ll do a bit of cleanup first, which will also give us a minor performance improvement. As mentioned in the “Performance” section, many of our connected components create Redux-ORM Session instances in their mapState functions. Creating these Session instances probably isn’t too expensive, but there really isn’t a good reason to keep creating many Session instances every time the store updates and then throw them all away. This is especially true because a Session instance wraps up a specific state “tables” object, and since all of our components will be doing reads and not writes, they could easily all do reads from the same Session instance with no ...