Skip to content

Instantly share code, notes, and snippets.

@diegocasmo
Created February 9, 2017 14:41
Show Gist options
  • Save diegocasmo/09867cc0de31ae4148a736dbfb2b1b17 to your computer and use it in GitHub Desktop.
Save diegocasmo/09867cc0de31ae4148a736dbfb2b1b17 to your computer and use it in GitHub Desktop.
Implementation of a <Tab/> component in React
export const Tab = (props) => {
return (
<li className="tab">
<a className={`tab-link ${props.linkClassName} ${props.isActive ? 'active' : ''}`}
onClick={(event) => {
event.preventDefault();
props.onClick(props.tabIndex);
}}>
<i className={`tab-icon ${props.iconClassName}`}/>
</a>
</li>
)
}
@diegocasmo
Copy link
Author

Source code for full implementation (including tests) can be found here: https://gist.github.com/diegocasmo/5cd978e9c5695aefca0c6a8a19fa4c69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment