{"action":"created","issue":{"url":"https://api.github.com/repos/kriasoft/react-starter-kit/issues/314","labels_url":"https://api.github.com/repos/kriasoft/react-starter-kit/issues/314/labels{/name}","comments_url":"https://api.github.com/repos/kriasoft/react-starter-kit/issues/314/comments","events_url":"https://api.github.com/repos/kriasoft/react-starter-kit/issues/314/events","html_url":"https://github.com/kriasoft/react-starter-kit/issues/314","id":116558778,"number":314,"title":"why is my state undefined  ?","user":{"login":"hyptos","id":1622722,"avatar_url":"https://avatars.githubusercontent.com/u/1622722?v=3","gravatar_id":"","url":"https://api.github.com/users/hyptos","html_url":"https://github.com/hyptos","followers_url":"https://api.github.com/users/hyptos/followers","following_url":"https://api.github.com/users/hyptos/following{/other_user}","gists_url":"https://api.github.com/users/hyptos/gists{/gist_id}","starred_url":"https://api.github.com/users/hyptos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyptos/subscriptions","organizations_url":"https://api.github.com/users/hyptos/orgs","repos_url":"https://api.github.com/users/hyptos/repos","events_url":"https://api.github.com/users/hyptos/events{/privacy}","received_events_url":"https://api.github.com/users/hyptos/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-12T14:29:44Z","updated_at":"2015-11-13T00:16:26Z","closed_at":"2015-11-12T14:33:11Z","body":"Hi,\r\n\r\nYou could check there : https://github.com/hyptos/checkJobs/blob/master/src/components/SearchForm/SearchForm.js\r\n\r\nthe error is : Uncaught TypeError: Cannot read property 'state' of undefined at line 24 of the file when I type something.\r\n\r\nI'm trying to use state in order to save the query from an input text search. I saw how you did it in the chat and tried to do the same. But I don't know why it still fails.\r\n\r\nCould you help me ?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/kriasoft/react-starter-kit/issues/comments/156277744","html_url":"https://github.com/kriasoft/react-starter-kit/issues/314#issuecomment-156277744","issue_url":"https://api.github.com/repos/kriasoft/react-starter-kit/issues/314","id":156277744,"user":{"login":"koistya","id":197134,"avatar_url":"https://avatars.githubusercontent.com/u/197134?v=3","gravatar_id":"","url":"https://api.github.com/users/koistya","html_url":"https://github.com/koistya","followers_url":"https://api.github.com/users/koistya/followers","following_url":"https://api.github.com/users/koistya/following{/other_user}","gists_url":"https://api.github.com/users/koistya/gists{/gist_id}","starred_url":"https://api.github.com/users/koistya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koistya/subscriptions","organizations_url":"https://api.github.com/users/koistya/orgs","repos_url":"https://api.github.com/users/koistya/repos","events_url":"https://api.github.com/users/koistya/events{/privacy}","received_events_url":"https://api.github.com/users/koistya/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T00:16:26Z","updated_at":"2015-11-13T00:16:26Z","body":"Alternatively you can bind your `doSeach` function to the component instance inside the constructor:\r\n\r\n```js\r\nclass SearchForm extends Component {\r\n\r\n  constructor() {\r\n    super();\r\n    this.state = { query: '' };\r\n    this.doSearch = this.doSearch.bind(this);\r\n  }\r\n\r\n  doSearch() {\r\n    this.setState({ query: event.target.value }};\r\n    this.props.doSearch(query);\r\n  }\r\n\r\n  render() {\r\n    // ...\r\n  }\r\n\r\n}\r\n```\r\n\r\nhttps://facebook.github.io/react/docs/reusable-components.html#no-autobinding"}}