Description
I'm having a bit of a hard time understanding the example provided on the main page in regards to stores.
I have two stores defined, each of which consists of a single function that returns an object. When creating my redux instance, I do the following:
var stores = {
authenticationStore: require("../stores/authentication-store"),
signUpStore: require("../stores/sign-up-store")
};
var dispatcher = Redux.createDispatcher(
Redux.composeStores(stores),
function (getState) {
return [promiseMiddleware(getState), thunkMiddleware(getState)];
}
);
So far so good, as far as I can tell.
My problem is that in the select method on one of my components, I attempt to read the store values as follows
function selectSignUpFormProps(state) {
// signUpStore returns an object containing signedUpUser and signUpError properties.
return {
user: state.signedUpUser,
error: state.signUpError
};
}
However instead of containing signedUpUser
and signUpError
properties as I would expect, state
contains authenticationStore
and signUpStore
properties which contain the return values of their respective functions.
By looking at the demo on the main page of the repo, I was under the impression that the results of my store functions would be composed into a single state object, and not subdivided by store. Am I doing something incorrectly, or is my understanding of stores/state flawed?