an example of how we can extend react custom component

// declare your component
import type { ComponentPropsWithoutRef } from 'react';
interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
label: string;
}
export function MyButton({ label, ...rest }: ButtonProps) {
return (<button><button {...rest} /></button>);
}
/// how to use it ////////
import {InputGroup, MyButton} from './com';
export default function About() {
let [counter, setCounter] = useState<number>(100)
return <div>Hello
<MyButton label='test'> </MyButton>
</div>
}

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20