GO
Size: a a a
GO
IK
MK
IK
Т
IK
Т
GO
IK
MK
A
꧁岡
MK
IK
OS
GO
OS
type Props<A> = { type: A };
export const FancyButton = forwardRef(function FancyButton<A>(
{ type }: Props<A>,
ref: RefObject<HTMLButtonElement>
) {
useImperativeHandle(ref, {
focus: () => console.log("focus")
});
return (
<button ref={ref} type={type}>
Button
</button>
);
});
function Test() {
const buttonRef = useRef(null);
return <FancyButton<"submit"> type="submit" ref={buttonRef} />;
}