React Router v4 路由器类型之间有什么区别?
What's the Difference between the React Router v4 Router Types?
我尝试在 YouTube 和官方文档中学习一些 React 基础知识,但我在两个视频中遇到了多个不同的路由器。可悲的是,教练根本没有解释任何事情,我比以前更加困惑。
dr:我真的不明白浏览器路由器、'normal' 路由器和索引路由器之间的区别。谢谢大家帮助我。
浏览器路由器doc
A Router
that uses the HTML5 history API (pushState, replaceState and the popstate event) to keep your UI in sync with the URL.
路线doc
Its most basic responsibility is to render some UI when a location matches the route’s path.
那东西到底是什么意思
BrowserRouter
是一个 React 组件,它监视 URL 并或多或少地将当前路径传递给它的子组件,而 Route
组件将渲染一些其他组件基于URL 父级 BrowserRouter
传递给它的信息。 IndexRoute
用于在渲染特定 Route
组件时设置默认视图。有关 .
的更多信息
请记住,react-router
只是一组巧妙实现的 vanilla React 组件,可用于模拟服务器端路由处理程序,从而使单页应用程序看起来像多个页面。
希望对您有所帮助!
我尝试在 YouTube 和官方文档中学习一些 React 基础知识,但我在两个视频中遇到了多个不同的路由器。可悲的是,教练根本没有解释任何事情,我比以前更加困惑。
dr:我真的不明白浏览器路由器、'normal' 路由器和索引路由器之间的区别。谢谢大家帮助我。
浏览器路由器doc
A
Router
that uses the HTML5 history API (pushState, replaceState and the popstate event) to keep your UI in sync with the URL.
路线doc
Its most basic responsibility is to render some UI when a location matches the route’s path.
那东西到底是什么意思
BrowserRouter
是一个 React 组件,它监视 URL 并或多或少地将当前路径传递给它的子组件,而 Route
组件将渲染一些其他组件基于URL 父级 BrowserRouter
传递给它的信息。 IndexRoute
用于在渲染特定 Route
组件时设置默认视图。有关
请记住,react-router
只是一组巧妙实现的 vanilla React 组件,可用于模拟服务器端路由处理程序,从而使单页应用程序看起来像多个页面。
希望对您有所帮助!