Closed
Description
I ran into an issue where I had an event handler that called setState
by passing in a function and accessing e.target.value
inside that function. It seems that Reacts synthetic events are "garbage collected" after the event handler has finished executing, which gave me an error when I tried to access value
of undefined
(since all properties were removed from the event object).
This is fine, and easy to fix by destructuring the event as in the argument (({target: {value}}) => this.setState(...)
instead of e => this.setState(...)
), but it should probably be documented.
Metadata
Metadata
Assignees
Labels
No labels