-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Question: why does the init action @@redux/INIT is being twice? #382
Comments
The first invocation is The next time you get |
I thought indeed that the random action type was here to perform a reducer sanity check but I didn't knew that the init action was used for a similar purpose in Thanks @gaearon ! |
I am sort of having problem with this. I am using following reducer stuff for managing my state:
As you can see that I have done a workaround however:
My question to @gaearon : Is this approach appropriate ? |
No, this is not how AJAX is Redux apps should work. Reducers should be pure and not cause side effects. You are doing an AJAX call from reducer, which is a side effect. I would suggest you to re-read the docs at http://redux.js.org/ and take a look at |
Good point. |
I'm new to React/Redux and not sure if I'm not doing something wrong. But I'm having a component making an AJAX call on And the problem is that often second Please see this log produced by the reducer: Am I doing something wrong? How can I solve this issue? Thanks! |
@ihor I would ask that kind of thing over on Stack Overflow. Not many people are going to see a comment from nearly one year old issue :) |
Hi,
I am using redux 1.0.0-rc.
I am sure this does not add any overhead to the redux initialization but I'd like to understand what is the intent behind the fact that the action @@redux/INIT is sent in both
Store.js
and incombineReducers.js
.Example:
Thanks!
The text was updated successfully, but these errors were encountered: