weixin_39789979
2020-11-26 18:19404 Routes
Im wondering if there is a simplified method for checking all routes and 404 routes, I have found the following to work, but it would be ideal to have 404 capability available via a fragment:
All routes (Not sure why this works actually):
<fragment forroute="">
<p>Matches all routes</p>
</fragment>
No route matches:
const App = (
context: {
router: RouterContext
}
) => {
const { matchRoute } = context.router.store;
const matchResult = matchRoute(location.pathname);
if(!matchResult) {
return( <div> 404 error </div>)
} else {
return( <div> Application </div>)
}
}
该提问来源于开源项目:FormidableLabs/redux-little-router
- 点赞
- 回答
- 收藏
- 复制链接分享
5条回答
为你推荐
- element向exp_res上传文件失败,一直返回404
- vue.js
- node.js
- 3个回答
- 如何在Golang(go-chi)路由器上同时提供“ / something”和“ / something /”?
- routes
- 1个回答
- 大猩猩Mux 404
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 1个回答
- symfony 1.4中的Json 404
- web-services
- json
- php
- 1个回答
- 一旦用户登录,Laravel定制防护不起作用
- routes
- laravel
- php
- 2个回答
换一换