首页 > 其他 > 详细

[React] React Router: activeStyle & activeClassName

时间:2016-03-28 07:03:28      阅读:821      评论:0      收藏:0      [点我收藏+]

react-router provides two props for setting a specific style on a Link component whose path matches our current route. activeStyle allows for an inline style while activeClassName allows for an class defined in an external stylesheet.

 

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>;

 

.active{
    color: green;
}

 

技术分享

[React] React Router: activeStyle & activeClassName

原文:http://www.cnblogs.com/Answer1215/p/5327591.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!