zoukankan      html  css  js  c++  java
  • react 学习笔记

    1.Router

    1.1 Histories

     React Router 是建立在 history 之上的。一个 history 知道如何去监听浏览器地址栏的变化, 并解析这个 URL 转化为 location 对象, 然后 router 使用它匹配到路由,最后正确地渲染对应的组件。

    常用的 history 有三种形式, 但是你也可以使用 React Router 实现自定义的 history。

    1.2 IndexRoute

      IndexRoute 代表Route 级别的默认路径,同时,需要包在Route内,目录结构如下:

    <Router history={browserHistory}>
        <Route path="/" component={App}>
          {/*IndexRoute 代表默认路由,如 url 为:  localhost:8080/   ,默认读取Respos;如果 url为: localhost:8080/about 读取About component ;
        如果不指定 IndexRoute ,默认为undefined, 访问localhost:8080/ 将不显然任何component
    */} <IndexRoute component={Repos} /> <Route path="/about" component={About}/> </Route> </Router>

     1.3 Params

       

     

      

  • 相关阅读:
    mfc启动画面
    个人冲刺第十天
    个人冲刺第九天
    个人冲刺第八天
    个人冲刺第七天
    个人冲刺第六天
    新一周冲刺计划2
    新一周冲刺
    创意1
    团队绩效与目标
  • 原文地址:https://www.cnblogs.com/rengised/p/6233495.html
Copyright © 2011-2022 走看看