react-notifications icon indicating copy to clipboard operation
react-notifications copied to clipboard

how to call createNotification() function without onClick event

Open tanvir510 opened this issue 4 years ago • 3 comments

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);

tanvir510 avatar Dec 23 '21 04:12 tanvir510

Came through same error. HELP!

sachingirime avatar Jan 18 '22 13:01 sachingirime

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 avatar Mar 05 '22 07:03 thecoolagency

@thecoolagency Thank you! It helps

sachingirime avatar Mar 05 '22 10:03 sachingirime