It means that the properties of the event only exist while the callback is active. Adding async to the mix, or storing the event for future use, will fail.
This is easily observed if you try console.log(event)
inside an event handler. By the time you inspect the object, most properties on the event object will be null
. If you stop execution of the script with debugger;
immediately after logging the value, you can inspect the values.
class MyComponent extends React.Component {
handleClick (e){
console.log('The event currentTarget is', e.currentTarget); // DOM element
setTimeout(() => {
console.log('event.currentTarget was', e.currentTarget); // null
}, 1000)
}
render () {
return <button onClick={this.handleClick}>Fire event!</button>
}
}
This will log a DOM element when you click the button, and null
a second later. For reasons beyond me, event.target
is still stored until the next event occurs, and not nullified.