如何正确设置404页面,以便用户点击任何不存在的路由时,重定向到该404页面?
目前我有这个代码:
import React from "react";
import Layout from "../components/layout";
import SEO from "../components/seo";
const NotFoundPage = () => (
<Layout>
<SEO title="404: Not found" />
<h1>NOT FOUND</h1>
<p>You just hit a route that doesn't exist... the sadness.</p>
</Layout>
);
export default NotFoundPage;
Run Code Online (Sandbox Code Playgroud)