{"action":"opened","issue":{"url":"https://api.github.com/repos/chenglou/react-tween-state/issues/24","labels_url":"https://api.github.com/repos/chenglou/react-tween-state/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/chenglou/react-tween-state/issues/24/comments","events_url":"https://api.github.com/repos/chenglou/react-tween-state/issues/24/events","html_url":"https://github.com/chenglou/react-tween-state/issues/24","id":59558345,"number":24,"title":"Error when onEnd removed component tweening state","user":{"login":"natew","id":12100,"avatar_url":"https://avatars.githubusercontent.com/u/12100?v=3","gravatar_id":"","url":"https://api.github.com/users/natew","html_url":"https://github.com/natew","followers_url":"https://api.github.com/users/natew/followers","following_url":"https://api.github.com/users/natew/following{/other_user}","gists_url":"https://api.github.com/users/natew/gists{/gist_id}","starred_url":"https://api.github.com/users/natew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natew/subscriptions","organizations_url":"https://api.github.com/users/natew/orgs","repos_url":"https://api.github.com/users/natew/repos","events_url":"https://api.github.com/users/natew/events{/privacy}","received_events_url":"https://api.github.com/users/natew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-02T21:59:21Z","updated_at":"2015-03-02T21:59:21Z","closed_at":null,"body":"This should probably work:\r\n\r\n```js\r\n      this.tweenState('step', {\r\n        endValue: 2,\r\n        duration: this.props.animationDuration,\r\n        onEnd: this.props.onClose\r\n        }\r\n      });\r\n```\r\n\r\nBut if props.onClose removes the tweening element I get an error `setState` on non-mounted component. This fixes it for now:\r\n\r\n```js\r\n      this.tweenState('step', {\r\n        endValue: 2,\r\n        duration: this.props.animationDuration,\r\n        onEnd: () => {\r\n          setTimeout(this.props.onClose);\r\n        }\r\n      });\r\n```"}}