0

Hello is it possible to inherit props from a HTML button or HTML input element? I only found solutions with typescript here: Extending HTML elements in React and TypeScript while preserving props

but with plain Javascript React i didnt found a solution.

otto
  • 1,815
  • 7
  • 37
  • 63
  • Remember that TypeScript is just Javascript with types. In the end, it's translated to JS. `extends` is a JS keyword, so it works both in TS and JS. – Eldar B. Sep 17 '21 at 08:41
  • Does this answer your question? [Reactjs - correct way of inherit props to first level children and nested children](https://stackoverflow.com/questions/34484307/reactjs-correct-way-of-inherit-props-to-first-level-children-and-nested-childr) – Eldar B. Sep 17 '21 at 08:43
  • @EldarB. no I want to inherit HTML Button or Input props – otto Sep 17 '21 at 08:45
  • @EldarB. Then I am using typescript in javascript files and i get this warning Type annotations can only be used in TypeScript files. So the solution was to switch to typescript? – otto Sep 17 '21 at 08:46
  • 2
    No, just use plain JS. Don't add types. – Eldar B. Sep 17 '21 at 08:55

0 Answers0