怎样使用React Router

前端

Winter

2017-09-21

             

 

                 React Router


*###end###*
 

Agenda

 

  • 基本用法
  • 模块分割
  • Router 4.0


*###end###*
基本用法

 

http://localhost:8080/#/repos,加载Repos组件;

http://localhost:8080/#/about,加载About组件

 

Router组件是一个容器,路由通过Route组件定义


*###end###*
路由嵌套

 

此时访问/about时,会先加载App组件,然后在它的内部再加载about组件。

应用场景:当你的页面有公共的导航和底部信息时则可以用路由嵌套的特性


*###end###*
路由嵌套-父组件的定义


*###end###*
 

第19篇《怎样使用React Router》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

0条评论