Skip to content

Commit

Permalink
lint fail fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
PunitSoniME committed Jan 12, 2024
1 parent 6f3fbf8 commit 58ecb41
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ export {
useScrollToTop,
useHash,
useSpeech,
useProvidersTree
useProvidersTree,
};
22 changes: 13 additions & 9 deletions src/useProvidersTree/index.tsx
Original file line number Diff line number Diff line change
@@ -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 <AccumulatedComponents>
<Provider {...props}>{children}</Provider>
</AccumulatedComponents>
}
}, initialComponent);
}
return componentsWithProps.reduce(
(AccumulatedComponents: any, [Provider, props = {}]: any) => {
return ({ children }: any) => {
return (
<AccumulatedComponents>
<Provider {...props}>{children}</Provider>
</AccumulatedComponents>
);
};
},
initialComponent
);
};

return buildProviders;
}
4 changes: 1 addition & 3 deletions src/useScrollToTop/index.tsx
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit 58ecb41

Please sign in to comment.