-
Notifications
You must be signed in to change notification settings - Fork 62
Description
I'm trying to do ssr with injected reducers using redux. However I'm seeing no store on the context when the renderToString
function is executed.
I'm essentially following this repo https://github.com/dlebedynskyi/react-playground and specifically i don't see this.context.store
in this component: https://github.com/dlebedynskyi/react-playground/blob/master/src/app/store/withAsyncReducers.js
That repo uses an outdated version of react async component and react async bootstrapped so I'm basically trying to do the same with the updated libraries. In the older version a variable appWithAsyncComponents
would exist after the bootstrap but now that doesn't exist. Would you have any idea why the context is an empty object when rendering to string but exists before that? Any guidance would be appreciated.
//... In my middleware fn...
const app = (
<AsyncComponentProvider asyncContext={asyncContext}>
<Provider store={store}>
<StaticRouter location={request.url} context={routerContext}>
<MyApp />
</StaticRouter>
</Provider>
</AsyncComponentProvider>
)
// this.context.store exists here👇
asyncBootstrapper(app).then(() => {
// app doesn't have store here 👇
const appString = renderToString(app)