{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/3657","labels_url":"https://api.github.com/repos/facebook/react/issues/3657/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/3657/comments","events_url":"https://api.github.com/repos/facebook/react/issues/3657/events","html_url":"https://github.com/facebook/react/issues/3657","id":68019494,"number":3657,"title":"Document that events are pooled","user":{"login":"andersekdahl","id":163637,"avatar_url":"https://avatars.githubusercontent.com/u/163637?v=3","gravatar_id":"","url":"https://api.github.com/users/andersekdahl","html_url":"https://github.com/andersekdahl","followers_url":"https://api.github.com/users/andersekdahl/followers","following_url":"https://api.github.com/users/andersekdahl/following{/other_user}","gists_url":"https://api.github.com/users/andersekdahl/gists{/gist_id}","starred_url":"https://api.github.com/users/andersekdahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersekdahl/subscriptions","organizations_url":"https://api.github.com/users/andersekdahl/orgs","repos_url":"https://api.github.com/users/andersekdahl/repos","events_url":"https://api.github.com/users/andersekdahl/events{/privacy}","received_events_url":"https://api.github.com/users/andersekdahl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-13T06:33:21Z","updated_at":"2015-04-20T17:33:04Z","closed_at":null,"body":"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).\r\n\r\nThis 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."},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/94517591","html_url":"https://github.com/facebook/react/issues/3657#issuecomment-94517591","issue_url":"https://api.github.com/repos/facebook/react/issues/3657","id":94517591,"user":{"login":"jsfb","id":9595985,"avatar_url":"https://avatars.githubusercontent.com/u/9595985?v=3","gravatar_id":"","url":"https://api.github.com/users/jsfb","html_url":"https://github.com/jsfb","followers_url":"https://api.github.com/users/jsfb/followers","following_url":"https://api.github.com/users/jsfb/following{/other_user}","gists_url":"https://api.github.com/users/jsfb/gists{/gist_id}","starred_url":"https://api.github.com/users/jsfb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsfb/subscriptions","organizations_url":"https://api.github.com/users/jsfb/orgs","repos_url":"https://api.github.com/users/jsfb/repos","events_url":"https://api.github.com/users/jsfb/events{/privacy}","received_events_url":"https://api.github.com/users/jsfb/received_events","type":"User","site_admin":false},"created_at":"2015-04-20T17:33:04Z","updated_at":"2015-04-20T17:33:04Z","body":"I think the motivation was performance (it is expensive to create lots of short lived objects, puts lots of pressure on the javascript garbage collector).  onClick wouldn't be a big deal, but a mouse-move event could fire very often.\r\n\r\nHaving said that, this issue keeps coming up as a surprising/confusing part of the framework (lots of people spend lots of time debugging an issue before they realize the problem), so it might make sense to consider changing this.  cc @zpao @spicyj "}}