-
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
is it possible to combineReducers? (combine stores in restate terminology) #1
Comments
The idea is to have only one store. Technically it is possible to combine data from multiple stores, but I would't do so. const sub1 = store1.regRootSub(
'sub1',
($root) => $root.data1
)
const sub2 = store2.regRootSub(
'sub2',
($root) => $root.data2
)
const sub3 = store1.regSub(
'sub3',
() => [sub1(), sub2()]
($sub1, $sub2) => $sub1 + $sub2
) |
so is it not possible to create hierarchy as in redux and immutableJS? or, do all entries has to be on the root level ? 🤔 |
Yes, you need to combine selectors(subs here). If you want, you can read more about this approach here https://day8.github.io/re-frame/subscriptions/ |
thanks, I am already using your library as is :)
|
I would do it like this export const orderForm = appDB.regRootSub(
'orderForm',
($root) => $state[ORDER_FORM_STATE]
)
export const getIbcTechnician = appDB.regSub(
'ibcTechnician',
() => orderForm(),
($orderForm) => orderForm.ibcTechnician
)
export const errorState = appDB.regRootSub(
'errorState',
($root) => $state[ERROR_STATE]
)
export const getIsErrorMessageDisplayed = appDB.regSub(
'isErrorMessageDisplayed',
() => errorState(),
($errorState) => errorState.isErrorMessageDisplayed
) I don't plan to add new functionality. It is already working I as planned, but thanks for the suggestion. |
not sure how this line could word:
when the function input is $root and the usage is $state ? |
yes, that is a mistake, it should be like this. ($root) => $root[ORDER_FORM_STATE] |
No description provided.
The text was updated successfully, but these errors were encountered: