Your context value is not memoized and is being used as inline JSX. This will make all subscribed components re-render on every update, leading to performance problems. The useMemo will help with this problem.
Subscribers to context should use React.memo for optimization.
I think the function selectFirstLevel is not really doing anything 🤔right? Anyhow for optimization, it should be removed.
The ISidebarContextInterface is incorrectly imported as SidebarContextInterface
@veksen so here are a few things about this PR:
useMemo
will help with this problem.React.memo
for optimization.selectFirstLevel
is not really doing anything 🤔right? Anyhow for optimization, it should be removed. TheISidebarContextInterface
is incorrectly imported asSidebarContextInterface