Memoize Button

This commit is contained in:
somebody1234 2024-11-21 21:14:10 +10:00
parent 6eb7541657
commit 27efdfd257

View File

@ -1,5 +1,6 @@
/** @file A styled button. */
import {
memo,
useLayoutEffect,
useRef,
useState,
@ -283,10 +284,8 @@ export const BUTTON_STYLES = tv({
})
/** A button allows a user to perform an action, with mouse, touch, and keyboard interactions. */
export const Button = forwardRef(function Button(
props: ButtonProps,
ref: ForwardedRef<HTMLButtonElement>,
) {
export const Button = memo(
forwardRef(function Button(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) {
const {
className,
contentClassName,
@ -494,4 +493,5 @@ export const Button = forwardRef(function Button(
</Tooltip>
</TooltipTrigger>
)
})
}),
)