memoize impertative function

This commit is contained in:
Nate Kelley 2025-01-23 12:57:37 -07:00
parent 16866accbb
commit c91647198d
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 8 additions and 4 deletions

View File

@ -178,11 +178,15 @@ export const AppSplitter = forwardRef<
} }
); );
const imperativeHandleMethods = useMemo(() => {
return () => ({
setSplitSizes,
animateWidth
});
}, [setSplitSizes, animateWidth]);
// Add useImperativeHandle to expose the function // Add useImperativeHandle to expose the function
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, imperativeHandleMethods);
setSplitSizes,
animateWidth
}));
return ( return (
<div className="h-full w-full"> <div className="h-full w-full">