Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create store failed when use handleActions with empty reducerMap #202

Closed
JuoCode opened this issue Mar 15, 2017 · 3 comments
Closed

Create store failed when use handleActions with empty reducerMap #202

JuoCode opened this issue Mar 15, 2017 · 3 comments

Comments

@JuoCode
Copy link

JuoCode commented Mar 15, 2017

I have a todosReducer:

import { handleActions } from 'redux-actions';

const initState = {}

export default handleActions({

}, initState)

Error message:

Uncaught Error: Reducer "todos" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.
@yangmillstheory
Copy link
Contributor

I think this is a usage issue. Why is your reducer map empty? It should at least declare an action.

@webholics
Copy link
Contributor

webholics commented Mar 20, 2017

I don't think this issue should've been closed.

handleActions should not break if it gets an empty object as first parameter. But currently it breaks because in this case it does not return the initial state anymore. To me this is clearly a bug.

@yangmillstheory
Copy link
Contributor

Good point. PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants