Skip to content

Instantly share code, notes, and snippets.

@hieptl
Created November 13, 2021 16:08
Show Gist options
  • Save hieptl/74e555ae706d519b82f9796eb5bddc74 to your computer and use it in GitHub Desktop.
Save hieptl/74e555ae706d519b82f9796eb5bddc74 to your computer and use it in GitHub Desktop.
Search.js - Discord Clone
const Search = (props) => {
const { onSearchChanged } = props;
const onChanged = (e) => {
const keywords = e.target.value.trim();
onSearchChanged(keywords);
};
return (
<div className="add-friend__search">
<span className="add-friend__search-title">Add Friend</span>
<p className="add-friend__search-sub-title">You can add a friend by searching their names!</p>
<input type="text" placeholder="Enter Username" onChange={onChanged} />
</div>
);
};
export default Search;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment