diff --git a/src/theme/NotFound/Content/index.js b/src/theme/NotFound/Content/index.js index 7414dc0cf..f975d3109 100644 --- a/src/theme/NotFound/Content/index.js +++ b/src/theme/NotFound/Content/index.js @@ -1,13 +1,12 @@ -import {useEffect} from "react"; +import React, { useEffect } from 'react'; +import { useHistory } from '@docusaurus/router'; + +export default function NotFoundContent() { + const history = useHistory(); -export default function NotFound() { useEffect(() => { - if (typeof window !== "undefined") { - // immediate redirect without adding to browser history - window.location.replace("/docs"); - } - }, []); + history.push('/docs/'); + }, [history]); - // render nothing (no content shown) return null; -} +} \ No newline at end of file