filter items by type only if there is type selected

This commit is contained in:
NikolaBorislavovHristov 2019-09-14 21:17:46 +03:00
parent 5b22240220
commit 489d677ffc

View file

@ -53,7 +53,7 @@ const libraryItems = [
const useLibrary = (type, sort) => {
const items = React.useMemo(() => {
return libraryItems.filter(item => item.type === type);
return libraryItems.filter(item => typeof type === 'string' && item.type === type);
}, [type, sort]);
const onSelect = React.useCallback((event) => {
const { name, value } = event.currentTarget.dataset;