0

I'm building a custom component that has a normal <button> tag and I'm adding a new prop to it called aria-current.

The problem is that Typescript complains that this property does not exist inside <button>(and it doesnt). My question is: How to add this property to a simple <button> tag?

enter image description here

ncesar
  • 1,592
  • 2
  • 15
  • 34

2 Answers2

2

enter image description here This property does exist on button, but you provide incorrect type. You need to specify the correct type and it will work fine

0

Hi before I could help can you add the reason why you want to add a props to button if the button tag dont get it's mean that he will never understand it and can't use it

UPDATE:

note that you can update but it will break the rest of the code you can look on this thread

How do I get the TypeScript engine to allow custom HTML attributes in JSX?

or this

How do I add attributes to existing HTML elements in TypeScript/JSX?

TalOrlanczyk
  • 1,205
  • 7
  • 21