Skip to content

Commit 6e89774

Browse files
committed
Merge pull request #2192 from asaf/patch-1
Update ServerRendering.md
2 parents 24e7b4f + fcd7856 commit 6e89774

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/guides/advanced/ServerRendering.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ It looks something like this with an imaginary JavaScript server:
1616
```js
1717
import { renderToString } from 'react-dom/server'
1818
import { match, RoutingContext } from 'react-router'
19+
import createLocation from 'history/lib/createLocation'
1920
import routes from './routes'
2021

2122
serve((req, res) => {
2223
// Note that req.url here should be the full URL path from
2324
// the original request, including the query string.
24-
match({ routes, location: req.url }, (error, redirectLocation, renderProps) => {
25+
const location = createLocation(req.url);
26+
match({ routes, location }, (error, redirectLocation, renderProps) => {
2527
if (error) {
2628
res.send(500, error.message)
2729
} else if (redirectLocation) {

0 commit comments

Comments
 (0)