Created
July 22, 2023 08:18
-
-
Save mitzen/72e17bc19e202ac019f7aae89130829a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment