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

How to create reducer with Immer ? #8

Closed
thaitanloi365 opened this issue Oct 2, 2019 · 2 comments
Closed

How to create reducer with Immer ? #8

thaitanloi365 opened this issue Oct 2, 2019 · 2 comments

Comments

@thaitanloi365
Copy link

thaitanloi365 commented Oct 2, 2019

Hi @BenLorantfy !

When I tried to create a reducer with Immer https://github.com/immerjs/immer.

const reducer = (state = initialState, action) => produce(state, draft => { switch (action.type) { case SIGNUP_REQUEST: draft.isFetching = true; break; } })

I got this error :
injectReducer: Expected reducer to be a reducer function

I think it shouldn't get the error.

Please help, thanks you.

@BenLorantfy
Copy link
Collaborator

hmm it should "just work"™ since your reducer is indeed a function. Can you share your redux store setup code?

@thaitanloi365
Copy link
Author

Thanks for your response, I found the causes, now It's working.

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

2 participants