JSFiddle - React, Tailwind, and code Playground

by kadonWills

HTML

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

<h3>
Coders never quit, quiter never code...
</h3>

JavaScript

swal("Game Over", "Play again ?", {
  buttons: {
    ok: {
      text: "OK",
      value: "1",
    },
    notok: {
      text: "cancel",
      value: "2",
    },
  },
})
.then((value) => {
  switch (value) {
 
    case "1":
      /** *code if ok here* */
			swal("cool", "you aren't a quitter", "success");
      break;
 
    case "2":
      /** *code if cancel here* */
			swal("Oh no!", "you are a quitter", "error");
			
      break;
  }
});