Skip to content

Commit 2ca2462

Browse files
authored
Merge pull request #3681 from reactjs/goBack-docs-tweak
Tweak goBack docs a bit
2 parents 85da056 + 8099159 commit 2ca2462

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

docs/guides/NavigatingOutsideOfComponents.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@
33
While you can use `this.props.router` from `withRouter` to navigate around, many apps want to be able to navigate outside of their components. They can do that with the history the app gives to `Router`.
44

55
```jsx
6-
// your main file that renders a Router
6+
// Your main file that renders a <Router>:
77
import { Router, browserHistory } from 'react-router'
88
import routes from './app/routes'
9-
render(<Router history={browserHistory} routes={routes}/>, el)
9+
10+
render(
11+
<Router history={browserHistory} routes={routes} />,
12+
mountNode
13+
)
1014
```
1115

1216
```jsx
13-
// somewhere like a redux/flux action file:
17+
// Somewhere like a Redux middleware or Flux action:
1418
import { browserHistory } from 'react-router'
15-
browserHistory.push('/some/path') // go to /some/path page
16-
browserHistory.goBack() // go back to previous page
19+
20+
// Go to /some/path.
21+
browserHistory.push('/some/path')
22+
23+
// Go back to previous location.
24+
browserHistory.goBack()
1725
```

0 commit comments

Comments
 (0)