Extending HTML elements in React and TypeScript while preserving props

后端 未结 6 1105
星月不相逢
星月不相逢 2021-02-04 23:58

I just can\'t wrap my head around this I guess, I\'ve tried probably half a dozen times and always resort to any... Is there a legitimate way to start with an HTML

6条回答
  •  温柔的废话
    2021-02-05 00:16

    You can change the definition of your component to allow the react html button props

    class MyButton extends React.Component, {}> {
        render() {
            return 

    That will tell the typescript compiler that you want to enter the button props along with 'MyButtonProps'

提交回复
热议问题