react-notifications
react-notifications copied to clipboard
how to call createNotification() function without onClick event
I want to handle API success and error, i just call createNotification() function. But its not work without onClick event. Please tell me that, how can i solve this issue.
My example code: createNotification('success', 'Success Title', 5000);
Came through same error. HELP!
Hello, I was able to fire the notifications without having an onclick event on a button:
import { NotificationContainer, NotificationManager } from 'react-notifications';
// ...
function customFunction() {
// do your things ...
NotificationManager.warning('Warning message', 'Close after 3000ms', 3000);
}
Hop that helps
@thecoolagency Thank you! It helps