Skip to content

Commit

Permalink
memoize filterData (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianca Del Carretto committed Jul 4, 2020
1 parent 42c6c05 commit a98d03e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/DomEventsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ const DomEventsTable = ({
setSelectedNames(selectedOptions);
}
};
const filterData = (event) =>
selectedTypes.find((type) => type.value === event.type) &&
selectedNames.find((name) => name.value === event.name);
const filterData = useCallback(
(event) =>
selectedTypes.find((type) => type.value === event.type) &&
selectedNames.find((name) => name.value === event.name),
[selectedNames, selectedTypes],
);

const getTextToCopy = () =>
data
Expand Down

0 comments on commit a98d03e

Please sign in to comment.