Skip to content

Instantly share code, notes, and snippets.

@antoniocapelo
Created May 2, 2019 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antoniocapelo/042c4dfc5496aced661e8bba34a971d0 to your computer and use it in GitHub Desktop.
Save antoniocapelo/042c4dfc5496aced661e8bba34a971d0 to your computer and use it in GitHub Desktop.
TSX component extending default HTML props
import React from 'react';
import { styled } from '@material-ui/styles';
import AppBar from '@material-ui/core/AppBar';
type CustomProps = { show: boolean };
// Let's imagine MyComponent is a special type of button...
type MyComponentProps = CustomProps & React.HTMLProps<HTMLButtonElement>;
const MyComponent = ({show, ...rest}: MyComponentProps) => {
....
}
export default HeaderBar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment