我试图添加正则表达式以允许如下所示的路径,但是我无法使其工作。
例如:
'/hello/search.apple.tree'
'/hello/search.mango.tr'
'/view/location.chicago.illinois'
'/view/location.boston.ma'
答案 0 :(得分:0)
React正在使用库作为路径(see react documentation)
该库称为path-to-regexp
您必须检查可用于此库的有效路径。
以下是您可以尝试直播的演示:valid path demo
答案 1 :(得分:0)
可能您可以通过将其添加到您的 webpack 开发服务器配置来解决。
historyApiFallback: {
disableDotRule: true
}
来自:https://github.com/ReactTraining/react-router/issues/3409