Home > Net >  how do i add an id to a div to compare it ? *(react)
how do i add an id to a div to compare it ? *(react)

Time:12-06

when i try to add an id to a div to compare it i get an error id is not defined .

the data enter image description here

the function enter image description here

the div where i tried to add an id enter image description here

i tried to add a key but it didn't work and the error i got was key is not defined

the id that is not defined is on the function where

id === quoteData.id

CodePudding user response:

The ID cannot start with number:

Note: The id name must contain at least one character, cannot start with a number, and must not contain whitespaces (spaces, tabs, etc.).

CodePudding user response:

you can't start the ID with a number , if you want to compare u need to concat an character with the numbers ex:

<div #id1></div>
<div #id2></div>
<div #id3></div>
  • Related