0

I have build my website using react. I have import a new library for other features the issue is that the new library used id and I have not assigned id to tags since all are rendered using a loop. Changing the code to give id to all tag is difficult since the code is spread across multiple files. What can I do in that case?

I have tried give id using this "uniqueid" library but it is really difficult to do.

I want a way in which all tags get a unique id.

Nikhil Ashodariya
  • 131
  • 1
  • 1
  • 4
  • Look here https://stackoverflow.com/questions/29420835/how-to-generate-unique-ids-for-form-labels-in-react – adesurirey Jun 14 '19 at 15:14
  • I read it but it uses a library uuid to generate it. But each time the page is loaded the id would be different I can't use it in my code to get the element. please correct me if i am wrong. And it would be better if it can be done without any extra library. I searched the web but it told that it is a bad idea to keep a global counter. – Nikhil Ashodariya Jun 14 '19 at 15:24
  • Please, provide a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) of the problem you are facing. – mgarcia Jun 14 '19 at 19:29

0 Answers0