{"action":"created","issue":{"url":"https://api.github.com/repos/rackt/redux/issues/159","labels_url":"https://api.github.com/repos/rackt/redux/issues/159/labels{/name}","comments_url":"https://api.github.com/repos/rackt/redux/issues/159/comments","events_url":"https://api.github.com/repos/rackt/redux/issues/159/events","html_url":"https://github.com/rackt/redux/issues/159","id":89958417,"number":159,"title":"Investigate using Redux for pseudo-local component state","user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rackt/redux/labels/discussion","name":"discussion","color":"fbca04"},{"url":"https://api.github.com/repos/rackt/redux/labels/future%20idea","name":"future idea","color":"434343"},{"url":"https://api.github.com/repos/rackt/redux/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2015-06-21T20:44:50Z","updated_at":"2015-09-14T21:42:54Z","closed_at":null,"body":"As @slorber [notes](https://github.com/gaearon/redux/issues/155#issuecomment-113927058), once you go single-treeish, local component state begins to bother you.\r\n\r\nI don't feel strongly about it (I'm fine with some local component state here and there), but it would be interested to explore API and implementation-wise the idea of replacing React local component state with state backed by Redux with “ephemeral” reducers whose data is erased when their owner component unmounts.\r\n\r\nI'm not sure if I'm actually making sense here.. Let's say that the litmus test is:\r\n\r\n* Have some API that looks similar to React's local state API. For example, a container component that injects `state` and `setState` as props.\r\n* Unlike React's local state API, under the hood, it works by emitting actions like `{ type: SET_LOCAL_STATE, ownerComponentId: '42424242' }`\r\n* There is a reducer that handles these actions. The container component subscribes to the slice of the state governed by that reducer\r\n* (The nice part) By default component IDs are unique but you can specify a function that generates the key from props. This lets components “mirror” the same state or “transplant” it across the tree. (cc @chenglou)\r\n\r\nRelated: [rethinking React's `key` and `state`](https://gist.github.com/chenglou/34b155691a6f58091953)."},"comment":{"url":"https://api.github.com/repos/rackt/redux/issues/comments/140213921","html_url":"https://github.com/rackt/redux/issues/159#issuecomment-140213921","issue_url":"https://api.github.com/repos/rackt/redux/issues/159","id":140213921,"user":{"login":"ashaffer","id":1871136,"avatar_url":"https://avatars.githubusercontent.com/u/1871136?v=3","gravatar_id":"","url":"https://api.github.com/users/ashaffer","html_url":"https://github.com/ashaffer","followers_url":"https://api.github.com/users/ashaffer/followers","following_url":"https://api.github.com/users/ashaffer/following{/other_user}","gists_url":"https://api.github.com/users/ashaffer/gists{/gist_id}","starred_url":"https://api.github.com/users/ashaffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashaffer/subscriptions","organizations_url":"https://api.github.com/users/ashaffer/orgs","repos_url":"https://api.github.com/users/ashaffer/repos","events_url":"https://api.github.com/users/ashaffer/events{/privacy}","received_events_url":"https://api.github.com/users/ashaffer/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T21:42:54Z","updated_at":"2015-09-14T21:42:54Z","body":"I am working on the side-effects issue over here [redux-effects](https://github.com/redux-effects/redux-effects) :-), I mediate all my effects this way, and it is working out pretty well so far.\r\n\r\nThat being said, how would you create a reusable dropdown component?  Assume that you want to close your dropdowns when the route changes.  If the dropdown stores its own state, you have to somehow inform the dropdown of this event.  How would you accomplish that?"}}