diff --git a/src/hooks/useSticky.ts b/src/hooks/useSticky.ts index 3d13575eb..f85929302 100644 --- a/src/hooks/useSticky.ts +++ b/src/hooks/useSticky.ts @@ -26,8 +26,9 @@ export default function useSticky( const container = getContainer() || defaultContainer; + const isSticky = !!sticky; + return React.useMemo(() => { - const isSticky = !!sticky; return { isSticky, stickyClassName: isSticky ? `${prefixCls}-sticky-holder` : '', @@ -36,5 +37,5 @@ export default function useSticky( offsetScroll, container, }; - }, [offsetScroll, offsetHeader, offsetSummary, prefixCls, container]); + }, [isSticky, offsetScroll, offsetHeader, offsetSummary, prefixCls, container]); }