How to add label to div in typescript file (React)

Viewed 31

I'm new to typescript an having warnings saying that: Property 'label' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> in a tsx file.

<div label="apple">
    Apple!
</div>
<div label="orange">
    Orange!
</div>

The code is compiled successfully, but that warning is annoying me.

How can I solve this warning?

1 Answers

The label attribute isn't a valid attribute on a div tag. Do you mean to use aria-label instead?

Related