React 系列知识

  1. nav导航点击后样式(刷新页面不变)
    //react-router提供了两种道具链接组件上设置一个特定的风格的路径匹配我们目前的路线。activeStyle允许内联风格而activeClassName允许一个类中定义一个外部样式表。
    
    const Links = () =>
        <nav >
            <Link activeStyle={{color: 'green'}} to="/">Home</Link>
            <Link activeStyle={{color: 'green'}} to="/about">About</Link>
            <Link activeClassName="active" to="/contact">Contact</Link>
        </nav>;
    
    
    //css样式
    .active{
        color: green;
    }
    View Code
  2. 使用react-router之后,如何向子组件传递一个事件handler? 参考链接:https://segmentfault.com/q/1010000007620558

  3. 嵌套路由传值  == this.props.children 跳转获取路由  
    1       { this.props.children && React.cloneElement(
    2                     this.props.children , { isShow : this.isShow.bind(this)}
    3                 )}
    View Code

     

  4. react 中添加setTimeout 访问链接
  5. 在React 中抛弃 .bind(this) 参考链接
posted @ 2017-02-16 12:06  DAOLIDEWONIU  阅读(177)  评论(0编辑  收藏  举报