# React's useId() hook generates stable unique IDs on both server and client

**Date:** 2025-12-07  
**Tags:** React, SSR, WebDev  
**URL:** https://kelexine.is-a.dev/til/react-useid-ssr

---

TIL: React's useId() hook generates stable unique IDs on both server and client. Perfect for SSR forms without hydration mismatches. No more 'id-client-1234' vs 'id-server-5678' bugs!


```jsx
function Form() {
  const id = useId();
  return (
    <>
      <label htmlFor={id}>Email:</label>
      <input id={id} name="email" />
    </>
  );
}
```



**Related:** [https://react.dev/reference/react/useId](https://react.dev/reference/react/useId)


---

*This content is available at [kelexine.is-a.dev/til/react-useid-ssr](https://kelexine.is-a.dev/til/react-useid-ssr)*
