React.js react-toastify Show Colorful Alert Toast or Notification Messages

Shell
Shell
Shell

Full Example with Source Code

App.js

JavaScript

Here we have a simple button to show alert messages. When we click this button the toastify alert notification will show in the center position as we had given the position top-center. Now, if you run the app, you will see something like the below screenshot.

react-toastify example
react-toastify example

As you can see we are showing the error notification message. Now, to show the success notification you need to change the below code in App.js file.

App.js

JavaScript
react-toastify example
react-toastify example

Themes of Notification Messages

Three themes are supported

  • dark
  • light
  • colored

Types of Notification Messages

  • error
  • warning
  • info
  • success
  • default

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.