{"action":"created","issue":{"url":"https://api.github.com/repos/rackt/redux/issues/1189","labels_url":"https://api.github.com/repos/rackt/redux/issues/1189/labels{/name}","comments_url":"https://api.github.com/repos/rackt/redux/issues/1189/comments","events_url":"https://api.github.com/repos/rackt/redux/issues/1189/events","html_url":"https://github.com/rackt/redux/issues/1189","id":124365140,"number":1189,"title":"Confusion about initial state, reducers and the Store.","user":{"login":"jugimaster","id":7930645,"avatar_url":"https://avatars.githubusercontent.com/u/7930645?v=3","gravatar_id":"","url":"https://api.github.com/users/jugimaster","html_url":"https://github.com/jugimaster","followers_url":"https://api.github.com/users/jugimaster/followers","following_url":"https://api.github.com/users/jugimaster/following{/other_user}","gists_url":"https://api.github.com/users/jugimaster/gists{/gist_id}","starred_url":"https://api.github.com/users/jugimaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jugimaster/subscriptions","organizations_url":"https://api.github.com/users/jugimaster/orgs","repos_url":"https://api.github.com/users/jugimaster/repos","events_url":"https://api.github.com/users/jugimaster/events{/privacy}","received_events_url":"https://api.github.com/users/jugimaster/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-30T15:58:29Z","updated_at":"2016-01-01T13:46:48Z","closed_at":"2015-12-30T16:11:39Z","body":"I'm still new to Redux, so I might be missing something here.\r\n\r\nWhen a reducer doesn't recognize an action, it's supposed/idiomatic to return the ```state``` given to it, right?\r\n\r\nBut when Redux is initializing the reducers, it calls them with ```undefined```, and in _that_ situation it's an error to return the given ```state```.\r\n\r\nSo if the Store is given initial data, wouldn't it make sense for Redux to 'initialize' the reducers with _that_ instead? That way we wouldn't have to worry about setting up some kind of initial state for each reducer directly.\r\n\r\nIt seems to me that Redux is trying to protect its users from themselves, and I can't help but think that's a bad idea. It's a bit like having a bicycle with training wheels you can't remove :)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rackt/redux/issues/comments/168307597","html_url":"https://github.com/rackt/redux/issues/1189#issuecomment-168307597","issue_url":"https://api.github.com/repos/rackt/redux/issues/1189","id":168307597,"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},"created_at":"2016-01-01T13:46:48Z","updated_at":"2016-01-01T13:46:48Z","body":">So if the Store is given initial data, wouldn't it make sense for Redux to 'initialize' the reducers with that instead?\r\n\r\nThis is exactly what happens. They'll receive that state as `state` argument. In this case the optional parameter won't matter at all. Optional arguments are only used when the value is undefined. This is why I'm asking for runnable code example: it seems that we are talking past each other because of some misconception about how these pieces fit together. "}}