Skip to content

Instantly share code, notes, and snippets.

@francoisgeorgy
Last active March 22, 2020 20:18
Show Gist options
  • Select an option

  • Save francoisgeorgy/ab48fc666c85638068b9e795159e2b4f to your computer and use it in GitHub Desktop.

Select an option

Save francoisgeorgy/ab48fc666c85638068b9e795159e2b4f to your computer and use it in GitHub Desktop.
#react #typescript props
interface IButtonProps {
text: string,
type: ButtonTypes,
action: () => void
}
const ExtendedButton : React.FC<IButtonProps> = ({text, type, action}) => {
//...
}
// We extend the FC (Functional Component) type with our own custom interface.
// Better:
interface IButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
text: string,
type: ButtonTypes,
action: () => void
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment