add useMemo to sidebar

This commit is contained in:
Mikhail Mikheev 2019-10-02 18:51:40 +04:00
parent 3b457d8647
commit 9ba01b3c56
1 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ import LegalLinks from './LegalLinks'
import useSidebarStyles from './style' import useSidebarStyles from './style'
const { useState, useEffect } = React const { useState, useEffect, useMemo } = React
type TSidebarContext = { type TSidebarContext = {
isOpen: boolean, isOpen: boolean,
@ -85,7 +85,7 @@ const Sidebar = ({
} }
} }
const filteredSafes = filterBy(filter, safes) const filteredSafes = useMemo(() => filterBy(filter, safes), [safes, filter])
return ( return (
<SidebarContext.Provider value={{ isOpen, toggleSidebar }}> <SidebarContext.Provider value={{ isOpen, toggleSidebar }}>