Created
November 13, 2021 15:44
-
-
Save hieptl/92a7019f3394fb73020f121274f0f4bb to your computer and use it in GitHub Desktop.
Header.js - Discord Clone
This file contains hidden or 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
const Header = (props) => { | |
const { onItemSelected, selectedOption } = props; | |
const selectItem = (index) => () => { | |
onItemSelected(index); | |
}; | |
return ( | |
<div className="friends__main-header"> | |
<span onClick={selectItem(1)} className={`${selectedOption === 1 ? 'friends__main-header--active' : ''}`}>Pending</span> | |
<span onClick={selectItem(3)} className="friends__add-friend">Add Friend</span> | |
</div> | |
); | |
}; | |
export default Header; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment