-
Notifications
You must be signed in to change notification settings - Fork 0
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
reducer initial state #77
Comments
I'm not exactly sure what you mean by this in this case. Before the user is authenticated or not, the state needs to be null. It then becomes false if the user is not authenticated or the associated user info object if the user is authenticated. This is how Stephen Grider did it in his Udemy course. |
Do you mean we should have all of the user object fields elucidated and set to null initially? Perhaps add a separate field for authenticated null, false or true? |
similar to this: export const initialState = {
assetLocks: {},
own: {},
members: {},
count: 0,
isSubscribed: false
}; just allows you to actually have initial state and gives you an idea of whats to come |
you want to make your reducers as futureproof as possible. |
in the same breath you want your reducers to be as flat as possible as well |
Ah I see. Where would we put the initialState constant? in the reducer index.js? The initial state is set in each individual reducer file in the default values of the function but I see what you mean, just not sure where you would actually use that variable? |
@shannonjensen each individual reducer will have its own initial state. I tend to put it at the top of each of the reducers' file |
https://github.com/fac-12/FAC-Events-Search/blob/master/client/src/reducers/authReducer.js#L3
i find its always helpful to have values as the initial state so that you can easily see what the reducer is expected to look like
The text was updated successfully, but these errors were encountered: