{"action":"created","issue":{"url":"https://api.github.com/repos/sapegin/react-styleguidist/issues/134","repository_url":"https://api.github.com/repos/sapegin/react-styleguidist","labels_url":"https://api.github.com/repos/sapegin/react-styleguidist/issues/134/labels{/name}","comments_url":"https://api.github.com/repos/sapegin/react-styleguidist/issues/134/comments","events_url":"https://api.github.com/repos/sapegin/react-styleguidist/issues/134/events","html_url":"https://github.com/sapegin/react-styleguidist/pull/134","id":151057153,"number":134,"title":"setState doesn't trigger rerender","user":{"login":"saschatimme","id":4854317,"avatar_url":"https://avatars.githubusercontent.com/u/4854317?v=3","gravatar_id":"","url":"https://api.github.com/users/saschatimme","html_url":"https://github.com/saschatimme","followers_url":"https://api.github.com/users/saschatimme/followers","following_url":"https://api.github.com/users/saschatimme/following{/other_user}","gists_url":"https://api.github.com/users/saschatimme/gists{/gist_id}","starred_url":"https://api.github.com/users/saschatimme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saschatimme/subscriptions","organizations_url":"https://api.github.com/users/saschatimme/orgs","repos_url":"https://api.github.com/users/saschatimme/repos","events_url":"https://api.github.com/users/saschatimme/events{/privacy}","received_events_url":"https://api.github.com/users/saschatimme/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-26T07:01:30Z","updated_at":"2016-04-26T07:28:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sapegin/react-styleguidist/pulls/134","html_url":"https://github.com/sapegin/react-styleguidist/pull/134","diff_url":"https://github.com/sapegin/react-styleguidist/pull/134.diff","patch_url":"https://github.com/sapegin/react-styleguidist/pull/134.patch"},"body":"This pull request should solve the issues in #51. \r\n\r\nThe previus method was basically, that we keep the state in memory and at every call of setState we render everything again. The problem is that this breaks animations as well as other \"dom-dependent\"actions.\r\n\r\nThis would have the following breaking API changes:\r\n\r\nInstead of:\r\n```js\r\n'count' in state || setState({ count : 1})\r\n```\r\n\r\nit would just be:\r\n\r\n```js\r\nsetState({ count : 1})\r\n```\r\n\r\nAnother breaking change would be, that instead of:\r\n\r\n```js\r\nconst mockData = require('./mocks');\r\n<Message content={mockData.hello}/>\r\n```\r\n\r\nyou would have to call require directly in the component:\r\n\r\n```js\r\n<Message content={require('./mocks').hello}/>\r\n```\r\n\r\nThe reason is that I split the example code at the (single) react component. Everything before will be executed in the ```componentWillMount``` and the rest in the ```render```method of a react component (calling setState in a render method is not possible).\r\n\r\nWould love to hear some feedback.\r\n\r\nP.S.: The examples seem to be broken because of the \"dog-names\" packages, which runs into an error.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sapegin/react-styleguidist/issues/comments/214653057","html_url":"https://github.com/sapegin/react-styleguidist/pull/134#issuecomment-214653057","issue_url":"https://api.github.com/repos/sapegin/react-styleguidist/issues/134","id":214653057,"user":{"login":"sapegin","id":70067,"avatar_url":"https://avatars.githubusercontent.com/u/70067?v=3","gravatar_id":"","url":"https://api.github.com/users/sapegin","html_url":"https://github.com/sapegin","followers_url":"https://api.github.com/users/sapegin/followers","following_url":"https://api.github.com/users/sapegin/following{/other_user}","gists_url":"https://api.github.com/users/sapegin/gists{/gist_id}","starred_url":"https://api.github.com/users/sapegin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sapegin/subscriptions","organizations_url":"https://api.github.com/users/sapegin/orgs","repos_url":"https://api.github.com/users/sapegin/repos","events_url":"https://api.github.com/users/sapegin/events{/privacy}","received_events_url":"https://api.github.com/users/sapegin/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T07:28:22Z","updated_at":"2016-04-26T07:28:22Z","body":"Thank you very much, this is very cool!\r\n\r\n```js\r\n'count' in state || setState({ count : 1})\r\n```\r\n\r\nIt was a hack so I won’t miss it ;-)\r\n\r\n```html\r\n<Message content={require('./mocks').hello}/>\r\n```\r\n\r\nIt’s fine when you need it only once (I think in most of the cases). Any way to reuse the required module?\r\n"}}