Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I write the content attribute in react?

this my code

<div  itemProp={"offers"} itemScope  itemType={"http://schema.org/Offer"}>
        <span  itemProp="price" content="10.00">{10}</span>
 </div>

I get this error.

Type '{ children: string; itemProp: string; content: string; }' is not assignable to type 'DetailedHTMLProps, HTMLSpanElement>'. Property 'content' does not exist on type 'DetailedHTMLProps, HTMLSpanElement>'.

I think the problem is content.


1 Answers

React Typescript - Adding custom attribute

 <div itemProp={"offers"} itemScope itemType={"http://schema.org/Offer"}>
          <span itemProp="price" {...{content: '10.00'}}>
            {10}
          </span>
  </div>
like image 87
aquz Avatar answered Nov 19 '25 23:11

aquz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!