From 06915c613e647b80229b405b75c416c549e8eb3b Mon Sep 17 00:00:00 2001 From: Patrik Kullman Date: Wed, 24 Jun 2020 08:13:01 +0200 Subject: [PATCH] fix: don't nest useMemo --- lib/use-data-nav.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/use-data-nav.js b/lib/use-data-nav.js index 1339661..24eb12f 100644 --- a/lib/use-data-nav.js +++ b/lib/use-data-nav.js @@ -1,15 +1,11 @@ -import { useMemo } from 'haunted'; import { useIncompleteTemplate } from './use-incomplete-template'; import { useCache } from './use-cache'; -export const useDataNav = el => { - const incompleteTemplates = useMemo(() => ({ +export const useDataNav = el => ({ + cache: useCache(el), + incompleteTemplates: { [el.selected - 1]: useIncompleteTemplate(el.selected - 1, el.items.length), [el.selected]: useIncompleteTemplate(el.selected, el.items.length), [el.selected + 1]: useIncompleteTemplate(el.selected + 1, el.items.length) - }), [el.selected, el.items.length]); - return { - cache: useCache(el), - incompleteTemplates - }; -}; + } +});