Skip to content

Instantly share code, notes, and snippets.

@paulodutra
Last active August 17, 2023 19:02
Show Gist options
  • Save paulodutra/0e082388d9b2cac067b8eb19c42ac96b to your computer and use it in GitHub Desktop.
Save paulodutra/0e082388d9b2cac067b8eb19c42ac96b to your computer and use it in GitHub Desktop.
Component button using React with typescript and PropsWithChildren
import React from 'react'
type ButtonProps = React.PropsWithChildren<{
lenghtButton?: string;
onClick?: () => void
}>
export const Button = ({children, lenghtButton, onClick}: ButtonProps) => {
return (
<button onClick={onClick} style={{fontSize: lenghtButton}}>
{children}
</button>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment