V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
toma77
V2EX  ›  React

关于 react-router4 的 BrowserRouter 的问题?

  •  
  •   toma77 · 2019-04-15 16:40:05 +08:00 · 1660 次点击
    这是一个创建于 1827 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我使用 create-react-app 脚手架创建项目 我看文档说明 BrowserRouter 使用 h5 的 historyAPI,如果在 localhost:8080/test 这个 url 下刷新,会返回 404,因为会向这个地址发起请求。

    问题是,为什么我本地在这个 url 下刷新不会 404 呢?理论上应该是 404 的啊

    我使用 yarn buld 打包上传到 githug pages 上后,在 localhost:8080/test 下刷新会 404,这是为什么呢?难道 create-react-app 对本地做了处理?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5536 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:43 · PVG 14:43 · LAX 23:43 · JFK 02:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.