You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The application shows a list of Gists fetched from the GitHub API, similar to the app shown by Ryan in the react-router 4 introduction video.
Expected Behavior
The browser's JavaScript console shows the following warning:
Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
(client) actid="3"><a href="/g/c31dde8e3656a8ae44
(server) actid="3"><a href="//g/c31dde8e3656a8ae4
This is due to the following bug in react router:
in the client, I'm using BrowserRouter; Link elements for the Gists in the side bar render anchor tags with the correct URLs, e.g. /g/f6230f5eed364763354be7b67e4aa6b7
in the server, I'm using StaticRouter; Link elements for the Gists in the side bar render anchor tags with incorrect URLs, they have an additional slash prepended: //g/f6230f5eed364763354be7b67e4aa6b7
This causes the warning from React that the markup rendered on the server differs from that from the client.
When you comment out the client-side rendering of the layout (lines 15-19 in src/client/index.js), you get only the server-side rendered page. When you click on any of the Gist links, you'll see that they are broken due to the prepended slash.
Actual Behavior
The Link element should render the correct URL when using StaticRouter for server-side rendering, without prepending a slash.
The text was updated successfully, but these errors were encountered:
Version
4.0.0-beta.5
Test Case
I've created a demo Express app that lets you reproduce the bug:
https://github.com/pahund/universal-react-router4
Run the application using:
Then point your browser to http://localhost:3000/
The application shows a list of Gists fetched from the GitHub API, similar to the app shown by Ryan in the react-router 4 introduction video.
Expected Behavior
The browser's JavaScript console shows the following warning:
This is due to the following bug in react router:
This causes the warning from React that the markup rendered on the server differs from that from the client.
When you comment out the client-side rendering of the layout (lines 15-19 in src/client/index.js), you get only the server-side rendered page. When you click on any of the Gist links, you'll see that they are broken due to the prepended slash.
Actual Behavior
The Link element should render the correct URL when using StaticRouter for server-side rendering, without prepending a slash.
The text was updated successfully, but these errors were encountered: