diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md index bda664f80888..ac65ae9ee67a 100644 --- a/CHANGELOG-2.x.md +++ b/CHANGELOG-2.x.md @@ -3,6 +3,16 @@ ## Unreleased - Reduce memory usage consumption. +- Add `` component for easy client side redirect. +Example Uaage: +```js +import React from 'react'; +import {Redirect} from '@docusaurus/router'; + +function Home() { + return ; +} +``` - Slightly adjust search icon position to be more aligned on small width device. - Convert sitemap plugin to TypeScript. - Significantly reduce main bundle size and initial HTML payload on production build. Generated JS files from webpack is also shorter in name. diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index dcb919eef87e..b0118b3ec146 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -1,6 +1,7 @@ --- id: docusaurus-core -title: Docusaurus Core API +title: Docusaurus Client API +sidebar_title: Client API --- Docusaurus provides some API on client that can be helpful when building your site. @@ -143,3 +144,18 @@ function Help() { ); } ``` + +## `` + +Rendering a `` will navigate to a new location. The new location will override the current location in the history stack, like server-side redirects (HTTP 3xx) do. You can refer to [React Router's Redirect documentation](https://reacttraining.com/react-router/web/api/Redirect) for more info on available props. + +Example usage: + +```jsx {2,5} +import React from 'react'; +import {Redirect} from '@docusaurus/router'; + +function Home() { + return ; +} +```