[v2] document the programmatic navigation API
See original GitHub issue🚀 Feature
A programmatic way to navigate through pages.
Have you read the Contributing Guidelines on issues?
Yes.
Motivation
Docusaurus v2 exposes a Link component but doesn’t seem to support a programmatic way to navigate through pages. This is unfortunate when creating Docusaurus themes.
I’m working on a brand new version of Docsearch for our Docusaurus integration, but we cannot leverage the Docusaurus navigation experience via keyboard without refreshes, which unnecessarily slows down the experience. These refreshes also means that we cannot leverage the underlying search client cache that caches the queries, to speed up the experience.

Pitch
An API similar to Gatsby’s navigate API would be perfect to leverage the Link API from keyboard navigation.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Interact programmatically with the Navigation component
The Navigation component provides ways to programmatically create and interact with certain navigation elements.
Read more >Modern client-side routing: the Navigation API
Learn about the Navigation API, a new API which adds improved functionality to build single-page applications.
Read more >Migrating to new navigation types
Improve navigation behavior in your app by replacing navigation views with navigation stacks and navigation split views.
Read more >Navigation API - GitHub Pages
The navigation API provides a web application-focused way of managing same-origin same-frame history entries and navigations. Status of this ...
Read more >Navigate a single-destination route
You can declare the fragment in your XML layout file as shown below: ... construct the fragment programmatically, as described in the Android...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yep that’s perfect, I missed that one for some reason—thank you!
(It’ll be a nice addition to the documentation)
Basically we just want to add some docs to https://v2.docusaurus.io/docs/docusaurus-core to tell people they can import
'@docusaurus/router'which is a re-export of React Router.