Skip to content

Commit 77d3945

Browse files
author
Hector Arce De Las Heras
committed
Pretiffier useImperativeHandle
1 parent 4bdd80b commit 77d3945

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/backToTop/backToTopControlled.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ const BackToTopControlledComponent = React.forwardRef(
2525

2626
const innerRef = React.useRef<HTMLButtonElement | null>(null);
2727

28-
React.useImperativeHandle(ref, () => {
29-
return innerRef?.current as HTMLButtonElement;
30-
}, []);
28+
React.useImperativeHandle(
29+
ref,
30+
() => {
31+
return innerRef?.current as HTMLButtonElement;
32+
},
33+
[]
34+
);
3135

3236
const { state, setRef } = useManageState({
3337
states: Object.values(BackToTopStateType) as States,

0 commit comments

Comments
 (0)