Making Modals Stackable
We'll cover the following...
Most of the time, you probably only need one modal open at once. But, what if you actually do need multiple modals open, stacked on top of each other? Fortunately, now that we’ve got the basic modal framework in place, this is pretty simple to add. All we really need to do have our reducer store an array of modal descriptions instead of just one, and have the ModalManager
component render multiple modals in response.
While we’re at it, we can update our TestModal
component to actually make use of the new functionality.
features/modals/modalReducer.js
-const initialState =
...