Check out example codes for "sweet alert". It will help you in understanding the concepts better.

Code Example 1

swal({
	title: "Good job!",
	text: "You clicked the button!",
	icon: "success",
	button: "Aww yiss!"
});

Code Example 2

swal({
     title: "Deleted!",
     text: "Your row has been deleted.",
     button: "Close", // Text on button
     icon: "success", //built in icons: success, warning, error, info
     timer: 3000, //timeOut for auto-close
      buttons: {
        confirm: {
          text: "OK",
          value: true,
          visible: true,
          className: "",
          closeModal: true
        },
        cancel: {
          text: "Cancel",
          value: false,
          visible: true,
          className: "",
          closeModal: true,
        }
      }
     });

Code Example 3

swal("Are you sure?", {  dangerMode: true,  buttons: true,});

Code Example 4

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

Code Example 5

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

Code Example 6

swal({  icon: "error",});

Learn ReactJs, React Native from akashmittal.com