{"action":"created","issue":{"url":"https://api.github.com/repos/Pitzcarraldo/reduxible/issues/8","labels_url":"https://api.github.com/repos/Pitzcarraldo/reduxible/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/Pitzcarraldo/reduxible/issues/8/comments","events_url":"https://api.github.com/repos/Pitzcarraldo/reduxible/issues/8/events","html_url":"https://github.com/Pitzcarraldo/reduxible/issues/8","id":124545582,"number":8,"title":"Reducers and action creators aren't a one-to-one mapping","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":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-01T13:56:13Z","updated_at":"2016-01-01T14:38:52Z","closed_at":null,"body":"This part of README worries me a lot:\r\n\r\n>Reduxible provides some utility functions to make redux actions and reducer simpler. You can define actions like below.\r\n\r\n>```js\r\n>const actions = {\r\n  ADD_TODO: {\r\n    creator: (todo) => {\r\n      return {\r\n        payload : {\r\n          todo\r\n        }\r\n      };\r\n    },\r\n    reducer: (payload, state) => {\r\n      const { todo } = payload;\r\n      const todos = [ ...state.todos, todo ];\r\n      return {\r\n        todos\r\n      };\r\n    }\r\n  }\r\n};\r\n```\r\n\r\nIt reinforces a very common misconception about Redux: namely that action creators and reducers are one-to-one mapping.\r\n\r\nThis is only true in trivial examples, but it is *extremely* limiting in real applications. **Beginners exposed to this pattern couple reducers and action creators, and fail to realize they're meant to be many-to-many and decoupled.**\r\n\r\nMany reducers may handle one action. One reducer may handle many actions. Putting them together negates many benefits of how Flux and Redux application scale. This leads to code bloat and unnecessary coupling. You lose the flexibility of reacting to the same action from different places, and your action creators start to act like “setters”, coupled to a specific state shape, thus coupling the components to it as well.\r\n\r\nI suggest you to refrain recommending this approach, or at least add a warning that Redux doesn't endorse it."},"comment":{"url":"https://api.github.com/repos/Pitzcarraldo/reduxible/issues/comments/168311271","html_url":"https://github.com/Pitzcarraldo/reduxible/issues/8#issuecomment-168311271","issue_url":"https://api.github.com/repos/Pitzcarraldo/reduxible/issues/8","id":168311271,"user":{"login":"hnordt","id":1625399,"avatar_url":"https://avatars.githubusercontent.com/u/1625399?v=3","gravatar_id":"","url":"https://api.github.com/users/hnordt","html_url":"https://github.com/hnordt","followers_url":"https://api.github.com/users/hnordt/followers","following_url":"https://api.github.com/users/hnordt/following{/other_user}","gists_url":"https://api.github.com/users/hnordt/gists{/gist_id}","starred_url":"https://api.github.com/users/hnordt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hnordt/subscriptions","organizations_url":"https://api.github.com/users/hnordt/orgs","repos_url":"https://api.github.com/users/hnordt/repos","events_url":"https://api.github.com/users/hnordt/events{/privacy}","received_events_url":"https://api.github.com/users/hnordt/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T14:38:52Z","updated_at":"2016-01-01T14:38:52Z","body":"Or maybe provide it as a simple helper for reducers and actions that are really coupled, still adding a warning about it of course."}}