Skip to content

Instantly share code, notes, and snippets.

@ovpv

ovpv/tab.js Secret

Created Mar 23, 2019
Embed
What would you like to do?
Tab Click Method
/* As you can see on click of the title i have added a function which executes the method
recieved through props from the accordion class, which return the active tab back to the accordion class */
class Tab extends React.Component{
render(){
return(
<div className="tab">
<div className="title flex jc-btwn" onClick={()=>{
this.props.handleclick(this.props.id)
}}>
<span>{this.props.title}</span>
<i className={this.props.active?"fas fa-minus" : "fas fa-plus"}></i>
</div>
<div className={this.props.active ? "content show" : "content hide"}>
{this.props.content}
</div>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment