Last active
June 7, 2022 21:45
-
-
Save Keraito/4ca022870a90ee760378faf4c0632a55 to your computer and use it in GitHub Desktop.
This file contains 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
import { MouseEventHandler, PropsWithChildren } from "react"; | |
type ComponentProps = { | |
title: string; | |
onClick: MouseEventHandler<HTMLButtonElement>; | |
}; | |
// `props.children` exists because of `PropsWithChildren`. | |
const Component = (props: PropsWithChildren<ComponentProps>) => ( | |
<div> | |
<h2>{props.title}</h2> | |
<button onClick={props.onClick}>{props.children}</button> | |
</div> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment