title: What is the easiest way to show a confirmation dialog in react-admin?
body: <p>In a react-admin project I created my own toolbar button that should display a confirmation dialog, similar to the JavaScript alert but not quite as ugly. </p>
  
  <p>Only when the user clicks OK, things should happen, in my case some database operations.</p>
  
  <p>is there an ootb alert dialog in react-admin or what is an easy way to create one?
  I could not find anything in the docs about that topic. I tried the alert example from material ui (see <a href="https://v1.material-ui.com/demos/dialogs/" rel="noreferrer">https://v1.material-ui.com/demos/dialogs/</a>) but due to my very limited understandig of react I am not able to create a reusable component from the example.</p>
  
  <p><strong>Update:</strong><br/>
  The code snippet below illustrates what I'd like to do:</p>
  
  <pre><code>// Definition of a toolbar button
  const ActionButton = ({ handleSubmitWithRedirect, ...props }) =&gt; {
      const form = useForm();
      var formdata = form.getState().values;
  
      switch (formdata.status.id) {
          case 0:
              props.label = "Text for state 0";
              break;
          case 1:
              props.label = "Text for state 2";
              break;
          default:
              props.label = "Unknown state"
      }
  
      const handleClick = useCallback(() =&gt; {
          switch (formdata.status.id) {
              case 0:
                  form.change('status', status[1]);
                  break;
              case 1:
                  // Here I want to open a confirmation Dialog...
                  if( openAlertDialog("Warning, things will happen","Okay","Better not")) 
                  {
                      form.change('status', status[2]);
                      createDatabaseRecord(formdata).then(() =&gt; (
                          // success handling [...]
                      ),
                      () =&gt; (
                          // error handling [...]
                      ))
                  };
                  break;
              default:
          }
          handleSubmitWithRedirect('list');
      }, [formdata, form]);
      return &lt;SaveButton {...props} handleSubmitWithRedirect={handleClick} /&gt;;
  };
  </code></pre>