Resetting and Canceling Form Edits
We'll cover the following...
Our last couple tasks will be to add the ability to reset our form contents back to the original values, and to add the ability to cancel a form edit entirely.
Resetting Entity Edits
Happily, this is another feature we can implement very easily, by reusing existing code. All we have to do is delete the relevant item out of the editingEntities
slice, and immediately copy the original item back over to editingEntities
.
features/editing/editingReducer.js
import {
EDIT_ITEM_EXISTING,
EDIT_ITEM_UPDATE,
EDIT_ITEM_APPLY,
...