Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // A tab item
  2. import React, {
  3. Component,
  4. PropTypes
  5. } from 'react'
  6.  
  7. import {
  8. Link,
  9. withRouter
  10. } from 'react-router'
  11.  
  12. @withRouter
  13. export default class LinkedTab extends Component {
  14.  
  15. render() {
  16. let { to, router } = this.props
  17. let active = router.isActive(to, true)
  18. let className = active ? 'active' : null
  19. return (
  20. <li className={ className }>
  21. <Link { ...this.props }>
  22. { this.props.title }
  23. </Link>
  24. </li>
  25. )
  26. }
  27.  
  28. }
  29.  
  30. LinkedTab.propTypes = {
  31. to: Link.propTypes.to,
  32. router: PropTypes.object.isRequired
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement