Welcome
TIL: React useId hook.md
All Notes
notes/til:-react-useid-hook

TIL: React useId hook

| notes

Use useId for accessible form labels.

function Input({ label }) {
  const id = useId();
  return (
    <>
      <label htmlFor={id}>{label}</label>
      <input id={id} />
    </>
  );
}

Generates stable IDs that work with SSR.