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: docs/docs/reference/built-in-components/gatsby-link.md
+6
Original file line number
Diff line number
Diff line change
@@ -290,6 +290,12 @@ const Form = () => (
290
290
)
291
291
```
292
292
293
+
### Navigate to the previous page
294
+
295
+
You can use `navigate(-1)` to go to a previously visited route. This is [Reach Router's](https://reach.tech/router/api/navigate) way of using `history.back()`. You can use any number as it uses [`history.go()`](https://developer.mozilla.org/en-US/docs/Web/API/History/go) under the hood. The `delta` parameter will be the number you pass in to `navigate()`.
296
+
297
+
If you want to check if there was a previous route you should [pass in an explicit state](#pass-state-as-props-to-the-linked-page) from your previously clicked internal link.
298
+
293
299
## Add the path prefix to paths using `withPrefix`
294
300
295
301
It is common to host sites in a sub-directory of a site. Gatsby lets you [set
0 commit comments