Skip to content

Instantly share code, notes, and snippets.

@hieptl
Created November 13, 2021 16:18
Show Gist options
  • Save hieptl/8d3d6dcdfe4c1eb343192821d0833716 to your computer and use it in GitHub Desktop.
Save hieptl/8d3d6dcdfe4c1eb343192821d0833716 to your computer and use it in GitHub Desktop.
User.js - Discord Clone
const User = (props) => {
const { user, onItemClicked } = props;
const selectUser = (user) => () => {
onItemClicked(user);
};
return (
<div className="add-friend__list-item" onClick={selectUser(user)}>
<div className="add-friend__list-item-left">
<img src={user.avatar} alt={user.fullname} />
<span>{user.fullname}</span>
</div>
</div>
);
};
export default User;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment