---
title: "Discussion on \"How to generate unique html ids in React\" | Hashnode"
description: "Discussion on \"How to generate unique html ids in React\". Edit:\nI noticed that this approach doesn't work for server-side rendering due to randomness. To solve that issue, React released useId in v18.\nTL;DR v2\nI published this work. See anilanar/idhook.\nTL;DR v1\nnpm install nanoid\n\nand then use this hook:\ni..."
url: "https://hashnode.com/posts/how-to-generate-unique-html-ids-in-react/610b1eafee887d4cb49657ba"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to generate unique html ids in React](https://anilanar.hashnode.dev/how-to-generate-unique-html-ids-in-react?utm_source=hashnode&utm_medium=feed)

Edit: I noticed that this approach doesn't work for server-side rendering due to randomness. To solve that issue, React released useId in v18. TL;DR v2 I published this work. See anilanar/idhook. TL;DR v1 npm install nanoid and then use this hook: i...

Aug 4, 2021 · 2 min read · anilanar.hashnode.dev  
Updated Apr 1, 2022  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#forms](https://hashnode.com/tag/forms)

## Written by

[Anıl Anar](https://hashnode.com/@anilanar)

@anilanar

  
[View profile](https://hashnode.com/@anilanar)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
