I have a react function
<button onClick={(e) => this.playVideo(e, name)}>
tried with both options
playVideo(event, name) {
console.log(event, 'event details');
setTimeout(function () {
console.log(event, 'event details inside timeout');
}, 1500)
}
playVideo(event, name) {
console.log(event, 'event details');
setTimeout(function (event) {
console.log(event, 'event details inside timeout');
}, 1500)
}
In the above code the initial event is working as expected but I need the event data inside settimout bcaz I have to load few js files based on the event, but event data inside settimeout function is always null.
I have also tried with onClickCapture but still no luck
<button onClickCapture={(e) => this.playVideo(e, name)}>