{"action":"opened","issue":{"url":"https://api.github.com/repos/reactjs/redux/issues/2250","repository_url":"https://api.github.com/repos/reactjs/redux","labels_url":"https://api.github.com/repos/reactjs/redux/issues/2250/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/redux/issues/2250/comments","events_url":"https://api.github.com/repos/reactjs/redux/issues/2250/events","html_url":"https://github.com/reactjs/redux/issues/2250","id":208485859,"number":2250,"title":"Docs -- Add a note explaining tradeoffs when using `combineReducers`?","user":{"login":"dmitrygusev","id":76579,"avatar_url":"https://avatars.githubusercontent.com/u/76579?v=3","gravatar_id":"","url":"https://api.github.com/users/dmitrygusev","html_url":"https://github.com/dmitrygusev","followers_url":"https://api.github.com/users/dmitrygusev/followers","following_url":"https://api.github.com/users/dmitrygusev/following{/other_user}","gists_url":"https://api.github.com/users/dmitrygusev/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitrygusev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitrygusev/subscriptions","organizations_url":"https://api.github.com/users/dmitrygusev/orgs","repos_url":"https://api.github.com/users/dmitrygusev/repos","events_url":"https://api.github.com/users/dmitrygusev/events{/privacy}","received_events_url":"https://api.github.com/users/dmitrygusev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-02-17T16:11:14Z","updated_at":"2017-02-17T16:11:14Z","closed_at":null,"body":"Currently in [Basics/Reducers/Splitting Reducers](https://github.com/reactjs/redux/blob/34b7b0650f43cfad3cb64bc700b97a511c6f57e9/docs/basics/Reducers.md#splitting-reducers) it's proposed to return JavaScript object with reducer functions:\r\n\r\n```java\r\n...\r\nfunction todoApp(state = {}, action) {\r\n  return {\r\n    visibilityFilter: visibilityFilter(state.visibilityFilter, action),\r\n    todos: todos(state.todos, action)\r\n  }\r\n}\r\n```\r\n\r\nAlthough it's the same semantically (as reducers are pure functions), it's not exactly the same as with the `switch` statement.\r\n\r\nWith `combineReducers` we still need to call the reducer functions in order to calculate the new state which involves unneeded CPU usage.\r\n\r\nIn previous steps of the tutorial the state was just copied using `Object.assign()` or the spread operator which is more efficient, as we know those parts won't be changed and we can only call the required reducers.\r\n\r\nAm I right here?"}}
{"actor":{"display_login":"dmitrygusev"}}