Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/UI/SearchToken/SearchToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ export const SearchToken = ({tokens, onSearchResults}) => {
};

useEffect(() => {
const results = tokens.filter(token => token.name.toLowerCase().includes(searchTerm));
const results = tokens.filter(token => {
const {name, symbol} = token;
const searchTermValue = searchTerm.toLowerCase();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can move this line outside of the filter iterator?


return (
name.toLowerCase().includes(searchTermValue) ||
symbol.toLowerCase().includes(searchTermValue)
);
});
onSearchResults(results);
}, [searchTerm]);

Expand Down