Catalog
为什么React Router v4中使用 switch 关键字
  • 由于router和switch对于路由的渲染策略不同,对router来说,如果有的链接既可以被路由A匹配,又可以被路由B匹配,那么Router会同时渲染它们
  • 对于switch来说,它只会渲染符合条件的第一个路径,避免重复匹配
Author: Erealm
Link: http://erealmsoft.github.io/2019/09/26/react/react-router-switch/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.

Comment