import { Switch, Prompt } from"react-router-dom"

Prompt组件: 

<Prompt when={true} message="提示消息">when为boolean值,true为会提示消息,false则不会提示

Redirect组件:

<Redirect path="/home" to="/about">或<Route path="/home" render={() => <Redirect to="/about">}>

match对象:匹配路由参数的对象,有属性url、path、isExact属性

react-router组件

Switch组件:

只渲染所匹配到的第一个


相关文章:

  • 2022-12-23
  • 2021-10-09
  • 2021-07-16
  • 2021-09-02
  • 2021-06-20
  • 2021-09-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案