React.js react-toastify Example to Show Colorful Alert Toast or Notification Messages in Browser Using Javascript

 

 

npx create-react-app toastifyexample

 

 

cd toastify

 

 

npm i react-toastify

 

 

Usage

 

 

Now inside your App.js file copy paste the below code

 

 

App.js

 

 

 

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 given the position top-center now if you run the app

 

 

 

 

As you can see we are showing the error notification message

 

 

Now to show the success notification you need to change the below code

 

 

 

 

 

 

Themes of Notification Messages

 

Three themes are supported

 

 

dark light and colored

 

 

Types of Notification Messages

 

 

error

 

warning

 

info

 

success

 

default

 

Leave a Reply