Build A Confirmation Modal in React with State Machines By Dave Ceddia August 19, 2020 Ever needed to wire up a confirmation dialog in React? You know the ones: “Really delete this file? — Yes / Cancel” These dialogs tend to follow a consistent pattern: User tries to do dangerous/destructive action Modal pops up asking if they’re really really sure On then hide the modal after the action is done I worked on an app that had a need to protect dangerous actions like Delete, in a few places across the app. The asynchronous nature of the flow (Confirm, wait until done, then close) meant that there would be plenty of finicky