{"action":"created","issue":{"url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/2","repository_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux","labels_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/2/comments","events_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/2/events","html_url":"https://github.com/slorber/scalable-frontend-with-elm-or-redux/issues/2","id":137908042,"number":2,"title":"Idea: Use 2 mailboxes/addresses/action types","user":{"login":"slorber","id":749374,"avatar_url":"https://avatars.githubusercontent.com/u/749374?v=3","gravatar_id":"","url":"https://api.github.com/users/slorber","html_url":"https://github.com/slorber","followers_url":"https://api.github.com/users/slorber/followers","following_url":"https://api.github.com/users/slorber/following{/other_user}","gists_url":"https://api.github.com/users/slorber/gists{/gist_id}","starred_url":"https://api.github.com/users/slorber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slorber/subscriptions","organizations_url":"https://api.github.com/users/slorber/orgs","repos_url":"https://api.github.com/users/slorber/repos","events_url":"https://api.github.com/users/slorber/events{/privacy}","received_events_url":"https://api.github.com/users/slorber/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-02T15:39:06Z","updated_at":"2016-03-03T10:00:30Z","closed_at":null,"body":"# Use 2 mailboxes/addresses/action types...\r\n\r\nNewGif component has a local state, but sometimes something that happens inside this component should trigger local changes but also changes in other places of the app.\r\n\r\nNested actions of Elm works really great for local state, but it's hard to listen for NEW_GIF actions in other components as they are nested. \r\n\r\nIn Flux/Redux, actions are not nested, so you can easily listen for `NEW_GIF` actions from anywhere, but it's hard to manage a bunch of nested NewGif components without the ceremony of having to assign each of them an UUID, creating a collection/store/reducer for a list of NewGif components... Many will use `this.setState()` with React and only dispatch `NEW_GIF` when needed because it is more easy to manage.\r\n \r\nI think we can work on combining these 2 approachs together. Decoupled components could only dispatch local actions that only themselves are aware of, and then a layer above it couple these decoupled components to our app by propagating the local event above the stack (nested event), AND dispatching a global application event (flat event).\r\n"},"comment":{"url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/comments/191689892","html_url":"https://github.com/slorber/scalable-frontend-with-elm-or-redux/issues/2#issuecomment-191689892","issue_url":"https://api.github.com/repos/slorber/scalable-frontend-with-elm-or-redux/issues/2","id":191689892,"user":{"login":"tomkis1","id":5079224,"avatar_url":"https://avatars.githubusercontent.com/u/5079224?v=3","gravatar_id":"","url":"https://api.github.com/users/tomkis1","html_url":"https://github.com/tomkis1","followers_url":"https://api.github.com/users/tomkis1/followers","following_url":"https://api.github.com/users/tomkis1/following{/other_user}","gists_url":"https://api.github.com/users/tomkis1/gists{/gist_id}","starred_url":"https://api.github.com/users/tomkis1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomkis1/subscriptions","organizations_url":"https://api.github.com/users/tomkis1/orgs","repos_url":"https://api.github.com/users/tomkis1/repos","events_url":"https://api.github.com/users/tomkis1/events{/privacy}","received_events_url":"https://api.github.com/users/tomkis1/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T10:00:30Z","updated_at":"2016-03-03T10:00:30Z","body":"> The counter should not receive flat business events. But the counter could for example be wrapped by a \"AppCounter\" component, which will receive the the business event, and transform it to a local event for the reusable and decoupled counter.\r\n\r\n> When I'm talking about 2 mailboxes, I imagine that reusable components have a single 1, but they are wrapped by a parent that has 2. It's the responsability of the wrapper to couple that reusable component to your app, by dispatching business events.\r\n\r\nThe question is though, does this approach really help us? Because you will avoid unwrapping the action based on component hierarchy but you will need to \"transform it to local event\" which is basically same as wrapping the action -> you need to be aware of the underlying component hierarchy.\r\n\r\nAm I missing something?"}}