diff --git a/src/index.tsx b/src/index.tsx index 27e1094..f7458d6 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -52,5 +52,5 @@ export { useScrollToTop, useHash, useSpeech, - useProvidersTree + useProvidersTree, }; diff --git a/src/useProvidersTree/index.tsx b/src/useProvidersTree/index.tsx index a39298a..bf5bc7e 100644 --- a/src/useProvidersTree/index.tsx +++ b/src/useProvidersTree/index.tsx @@ -1,18 +1,22 @@ import * as React from 'react'; export default function useProvidersTree() { - const buildProviders = (componentsWithProps: any) => { const initialComponent = ({ children }: any) => <>{children}; - return componentsWithProps.reduce((AccumulatedComponents: any, [Provider, props = {}]: any) => { - return ({ children }: any) => { - return - {children} - - } - }, initialComponent); - } + return componentsWithProps.reduce( + (AccumulatedComponents: any, [Provider, props = {}]: any) => { + return ({ children }: any) => { + return ( + + {children} + + ); + }; + }, + initialComponent + ); + }; return buildProviders; } diff --git a/src/useScrollToTop/index.tsx b/src/useScrollToTop/index.tsx index 68f3859..001d6dc 100644 --- a/src/useScrollToTop/index.tsx +++ b/src/useScrollToTop/index.tsx @@ -1,11 +1,9 @@ export default function useScrollToTop() { const scrollToTop = (elementId?: string) => { - if (elementId) { const element = document.getElementById(elementId); element?.scrollTo(0, 0); - } - else { + } else { const c = document.documentElement.scrollTop || document.body.scrollTop; if (c > 0) {