In ReactReduxSpa, configure store before matching routes. Fixes #663
This commit is contained in:
parent
c9526dd4d2
commit
3162946139
|
|
@ -10,6 +10,7 @@ import configureStore from './configureStore';
|
||||||
export default createServerRenderer(params => {
|
export default createServerRenderer(params => {
|
||||||
return new Promise<RenderResult>((resolve, reject) => {
|
return new Promise<RenderResult>((resolve, reject) => {
|
||||||
// Match the incoming request against the list of client-side routes
|
// Match the incoming request against the list of client-side routes
|
||||||
|
const store = configureStore();
|
||||||
match({ routes, location: params.location }, (error, redirectLocation, renderProps: any) => {
|
match({ routes, location: params.location }, (error, redirectLocation, renderProps: any) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
throw error;
|
throw error;
|
||||||
|
|
@ -27,7 +28,6 @@ export default createServerRenderer(params => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build an instance of the application
|
// Build an instance of the application
|
||||||
const store = configureStore();
|
|
||||||
const app = (
|
const app = (
|
||||||
<Provider store={ store }>
|
<Provider store={ store }>
|
||||||
<RouterContext {...renderProps} />
|
<RouterContext {...renderProps} />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue