-
-
Save ovpv/839e834a0c880a1ff4a315eae17de8d0 to your computer and use it in GitHub Desktop.
Tab Click Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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