Skip to content

Instantly share code, notes, and snippets.

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