From 40d63322b5f439bc99352646677ad557c451dc80 Mon Sep 17 00:00:00 2001 From: endiliey Date: Tue, 29 Oct 2019 22:08:28 +0700 Subject: [PATCH 1/5] docs(v2): Redirect component for easy redirect --- CHANGELOG-2.x.md | 10 ++++++++++ website/docs/docusaurus-core.md | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md index bda664f80888..ed4a7da4375b 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..5465fc2ab61c 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -143,3 +143,18 @@ function Help() { ); } ``` + +## `Redirect` + +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://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Redirect.md) for more info on available props. + +Example usage: + +```jsx {5} +import React from 'react'; +import Redirect from '@docusaurus/router'; + +function Home() { + return ; +} +``` From 203bd8bfd801e41ae895ba6dc3c9f44b41f40790 Mon Sep 17 00:00:00 2001 From: endiliey Date: Tue, 29 Oct 2019 22:15:05 +0700 Subject: [PATCH 2/5] typo --- CHANGELOG-2.x.md | 2 +- website/docs/docusaurus-core.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md index ed4a7da4375b..ac65ae9ee67a 100644 --- a/CHANGELOG-2.x.md +++ b/CHANGELOG-2.x.md @@ -7,7 +7,7 @@ Example Uaage: ```js import React from 'react'; -import Redirect from '@docusaurus/router'; +import {Redirect} from '@docusaurus/router'; function Home() { return ; diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index 5465fc2ab61c..0f9ab8e4d039 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -152,7 +152,7 @@ Example usage: ```jsx {5} import React from 'react'; -import Redirect from '@docusaurus/router'; +import {Redirect} from '@docusaurus/router'; function Home() { return ; From 8e15265e2d6ba1646909628ed579de39372c5789 Mon Sep 17 00:00:00 2001 From: endiliey Date: Tue, 29 Oct 2019 22:19:20 +0700 Subject: [PATCH 3/5] docs --- website/docs/docusaurus-core.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index 0f9ab8e4d039..b3a073a11141 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. @@ -144,7 +145,7 @@ function Help() { } ``` -## `Redirect` +## `` 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://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Redirect.md) for more info on available props. From 376f7215cdde23f42df27db1c9ad2a9b47e94830 Mon Sep 17 00:00:00 2001 From: Endi Date: Tue, 29 Oct 2019 22:25:35 +0700 Subject: [PATCH 4/5] Update website/docs/docusaurus-core.md Co-Authored-By: Alexey Pyltsyn --- website/docs/docusaurus-core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index b3a073a11141..8eb354cc1546 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -147,7 +147,7 @@ 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://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Redirect.md) for more info on available props. +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: From a65840ec694ebaa1e50bfbdd5f1e3fb46f843404 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Wed, 30 Oct 2019 08:40:11 +0800 Subject: [PATCH 5/5] Update docusaurus-core.md --- website/docs/docusaurus-core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index 8eb354cc1546..b0118b3ec146 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -151,7 +151,7 @@ Rendering a `` will navigate to a new location. The new location will Example usage: -```jsx {5} +```jsx {2,5} import React from 'react'; import {Redirect} from '@docusaurus/router';