Skip to content

Commit

Permalink
Replaced on key down with on key up event to fix search funcitonality
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-ditto committed Jul 15, 2021
1 parent dd88063 commit 30f0092
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const SearchField = () => {

const dispatch = useDispatch();

const onKeyDownHandler = async (event) => {
const onKeyUpHandler = async (event) => {
dispatch(searchActions.setSearchValue(event.target.value));
}

Expand All @@ -17,7 +17,7 @@ const SearchField = () => {
return (
<div className="search-field__container">
<FontAwesomeIcon icon={faSearch} />
<input type="text" placeholder="Search for country..." onKeyDown={onKeyDownHandler} />
<input type="text" placeholder="Search for country..." onKeyUp={onKeyUpHandler} />
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Countries = () => {

useEffect(() => {
dispatch(filterCountries(allCountries, filter));
if (initial.initial ) {
if (initial.initial) {
initial.initial = false;
}

Expand Down

0 comments on commit 30f0092

Please sign in to comment.