Sorry for bad English.
I'm struggling with ssr(pure react) + redux + code splitting(@loadable) + injecting redux. (highly effected by react-boilerplate)
currently my code working great without preload data.
I don't know how can I handle ssr preload data before inject reducer.
here is example to help my problem is.
store = {
global: { // default
key: 'value' // this is done. ssr working great using this value.
},
injected: { // dynamically injected. using replaceReducer per page. (same with react-boilerplate)
key: 'value' // I want to put this value on ssr preload. (not working)
}
}
When it done, it said
Unexpected property "injected" found in previous state received by the reducer. Expected to find one of the known reducer property names instead: "global". Unexpected properties will be ignored.
I know why this error comes(because initial store does not has 'injected' store.), but I don't know How can I fix it properly.
Is there any usage example?
Here is my thought, but it seemed not proper answer.
- insert key for preload data on 'global'.
- put preload data on 'global' in server.
- Move global to injected store(in this case, 'injected') when injecting is done.
- voila!