From ed97d61542889bd0054c1b4a7d8c70f43e74c8ce Mon Sep 17 00:00:00 2001 From: Valentin Hervieu Date: Mon, 17 Jun 2019 08:32:48 +0200 Subject: [PATCH] Add a more explicit note on SSR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is already a `How to implement server-side rendering` link to a very nice article. However, we should still be explicit regarding not to use `ConnectedRouter` on server-side. Indeed, in one of our applications, we happen to be running with the `ConnectedRouter` on server-side and it was running fine. However, after updating `react-redux` to `7.1` (from `7.0`), the app was starting to break. This was due to the fact that we were using the `context` prop like the `staticContext` prop of `StaticRouter` 😬 Of course, all our logic using the `StaticContext` was also silently breaking ^^ --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5744201d..c33457fc 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ export default function configureStore(preloadedState) { - Wrap your react-router v4/v5 routing with `ConnectedRouter` and pass the `history` object as a prop. Remember to delete any usage of `BrowserRouter` or `NativeRouter` as leaving this in will [cause](https://github.com/supasate/connected-react-router/issues/230#issuecomment-461628073) [problems](https://github.com/supasate/connected-react-router/issues/230#issuecomment-476164384) synchronising the state. - Place `ConnectedRouter` as a child of `react-redux`'s `Provider`. +- **N.B.** If doing server-side rendering, you should still use the `StaticRouter` from `react-router` on the server. ```js // index.js