Skip to content

Commit

Permalink
Fixed: Bug
Browse files Browse the repository at this point in the history
Bug: Again the bug is app crashed when user press enter with a space or spaces in search input. Fix: trim down the trailing and leading spaces from search
  • Loading branch information
oggy107 committed Feb 16, 2022
1 parent c4ce1a6 commit 4d210f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function useSearch (setLocalState) {

const handleKeyPress = (event) => {
if (event.key === 'Enter') {
if (search !== '') {
if (search.trim() !== '') {
fetchPokemon(search.toLowerCase())
.then(
data => {
Expand Down

0 comments on commit 4d210f4

Please sign in to comment.