Skip to content

Commit 23df45e

Browse files
authored
fix: redirect (#2246)
1 parent ab9b738 commit 23df45e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/pages/index.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import React, { useEffect } from "react";
2+
import { useHistory } from "@docusaurus/router";
23
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
34

4-
const Home = () => {
5+
export default function HomeRedirect() {
6+
const history = useHistory();
57
useEffect(() => {
6-
if (ExecutionEnvironment.canUseDOM) {
7-
window.location.href = "/guides";
8+
if (ExecutionEnvironment?.canUseDOM) {
9+
history.replace("/guides/");
810
}
911
}, []);
10-
11-
return <></>;
12-
};
13-
14-
export default Home;
12+
return null;
13+
}

0 commit comments

Comments
 (0)