Is it possible to add onclick event inside the messages' parameter of UIKIT.notification?
Something like this:
notif__undoDelete = (param) => {
setTimeout(function(param) {
UIkit.notification(
`<div class="uk-flex uk-flex-middle uk-margin-medium-right">
<span>Exercise Deleted.</span><a onclick="{here}" class="uk-button uk-button-primary uk-button-small uk-margin-auto-left">Undo</a>
</div>`,
{ timeout: 6000, pos: "bottom-left" }
)
}, 800, param)
}
I use this answer to solve my problem
Call react component's function from external JavaScript function
I added in componentDidMount method first:
I have an
undoDelete()
method somewhere and when I call my UIkit.notification it's gonna be something like this and my react'sundoDelete()
method will be called. I added data-param as well to pass parameters.)