vanilla-antd-message is a vanilla JavaScript notification library based on Ant Design, it can allow us to create info, success, error, and warning toast notification easily.
How to create notification using vanilla-antd-message?
1.Install vanilla-antd-message
# NPM $ npm install vanilla-antd-message --save
2.Import vanilla-antd-message
import message from 'vanilla-antd-message' import 'vanilla-antd-message/dist/style.css'
3.Create a new Message instance
const message = new Message();
3.Use Message instance to show differenet notifications
message.info('Info Message', duration, onClose); message.success('Success Message', duration, onClose); message.error('Error Message', duration, onClose); message.warn('Warn Message', duration, onClose);
4.You can change the default duration in milliseconds
Message.prototype.duration = 3000