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
Copy file name to clipboardExpand all lines: packages/gatsby-link/README.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,19 +53,20 @@ render () {
53
53
54
54
## Programmatic navigation
55
55
56
-
For cases when you can only use event handlers for navigation, you can use
57
-
`navigateTo`:
56
+
For cases when you can only use event handlers for navigation, you can use `push` or `replace`. `push` is a wrapper for `history.push` and `replace` wraps `history.replace`.
58
57
59
58
```jsx
60
-
import { navigateTo } from"gatsby-link"
59
+
import { push } from"gatsby-link"
61
60
62
61
render () {
63
-
<div onClick={ () =>navigateTo('/example')}>
62
+
<div onClick={ () =>push('/example')}>
64
63
<p>Example</p>
65
64
</div>
66
65
}
67
66
```
68
67
68
+
Note that `push` was previously named `navigateTo`. `navigateTo` will be deprecated in Gatsby v2.
69
+
69
70
## Prefixed paths helper
70
71
71
72
Gatsby allows you to [automatically prefix links](/docs/path-prefix/) for sites
0 commit comments