在Gatsby中到达路由器链接闪烁页面,然后消失

问题描述

我正在Gatsby中使用“到达路由器”来设置客户端路由,如下所示,但是当我单击“关于”页面的链接时,它会闪烁“关于”组件中的内容,然后消失。

man environ

我还发现,当我用import React from "react" import { Router,Link } from "@reach/router" import About from "../components/about.js" import Layout from "../components/layout" const IndexPage = () => ( <Layout> <Link to="about">About</Link> <Router> <MapContainer path="/" /> <About path="/about" /> </Router> </Layout> ) export default IndexPage 代替import { Link } from 'gatsby'时,直接进入Gatsby的404页。

在这两种情况下,浏览器上的“后退”按钮都将我带回到主页(显示MapContainer),这意味着链接正在尝试查找不存在的静态页面。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)