mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 02:12:36 +02:00
docs(v2): Redirect component for easy redirect (#1913)
* docs(v2): Redirect component for easy redirect * typo * docs * Update website/docs/docusaurus-core.md Co-Authored-By: Alexey Pyltsyn <lex61rus@gmail.com> * Update docusaurus-core.md
This commit is contained in:
parent
6fcee6dde4
commit
16f10dd32a
2 changed files with 27 additions and 1 deletions
|
@ -9,6 +9,16 @@ If you've swizzled Algolia `SearchBar` component before, please update your sour
|
||||||
+ <div className="navbar__search" key="search-box">
|
+ <div className="navbar__search" key="search-box">
|
||||||
```
|
```
|
||||||
- Reduce memory usage consumption.
|
- Reduce memory usage consumption.
|
||||||
|
- Add `<Redirect>` component for easy client side redirect.
|
||||||
|
Example Uaage:
|
||||||
|
```js
|
||||||
|
import React from 'react';
|
||||||
|
import {Redirect} from '@docusaurus/router';
|
||||||
|
|
||||||
|
function Home() {
|
||||||
|
return <Redirect to="/docs/test" />;
|
||||||
|
}
|
||||||
|
```
|
||||||
- Slightly adjust search icon position to be more aligned on small width device.
|
- Slightly adjust search icon position to be more aligned on small width device.
|
||||||
- Convert sitemap plugin to TypeScript.
|
- 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.
|
- Significantly reduce main bundle size and initial HTML payload on production build. Generated JS files from webpack is also shorter in name.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
id: docusaurus-core
|
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.
|
Docusaurus provides some API on client that can be helpful when building your site.
|
||||||
|
@ -143,3 +144,18 @@ function Help() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## `<Redirect />`
|
||||||
|
|
||||||
|
Rendering a `<Redirect>` 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 <Redirect to="/docs/test" />;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue