React confirm modal and redux middleware
<p>I'm new to React and Redux also. I want to remove item from the list so I dispatch an action <code>deleteSelectedItems</code> then I use redux middleware to catch it and show confirm. That looks like below:</p>

<p><strong>Action:</strong></p>

<pre><code>export const deleteSelectedItems = () =&gt; {
  return {
    type: ActionTypes.ITEM.DELETE_SELECTED,
    payload: {
      confirm: {
        message: 'Are you sure you want to delete these selected items?'
      }
    }
  }
};
</code></pre>

<p><strong>Middleware:</strong></p>

<pre><code>const confirmMiddleware = store =&gt; next =&gt; action =&gt; {
  if (action.payload.confirm) {
    if (confirm(action.payload.confirm.message)) {
      next(action);
    }
  } else {
    next(action);
  }
};
</code></pre>

<p>Everything works well. Now, I don't want to use <code>confirm()</code> to show confirm dialog, I want to use my own <code>ConfirmDialog</code> component instead.
I found <a href="https://stackoverflow.com/a/35641680/4283455">@Dan Abramov solution</a>, that is great. But I am confused how to integrate those together. I want to use <code>confirmMiddleware</code> to dispatch an action that show modal but I don't know how to handle when user click ok or cancel on modal. How can I do that?</p>