I'm building an app that needs to show a confirm dialog in some situations.
Let's say I want to remove something, then I'll dispatch an action like
deleteSomething(id) so some reducer will catch that event and will fill the dialog reducer in order to show it.
My doubt comes when this dialog submits.
- How can this component dispatch the proper action according to the first action dispatched?
- Should the action creator handle this logic?
- Can we add actions inside the reducer?
to make it clearer:
deleteThingA(id) => show dialog with Questions => deleteThingARemotely(id) createThingB(id) => Show dialog with Questions => createThingBRemotely(id)
So I'm trying to reuse the dialog component. Showing/hiding the dialog it's not the problem as this can be easily done in the reducer. What I'm trying to specify is how to dispatch the action from the right side according to the action that starts the flow in the left side.