Q30: What is the useId hook introduced in React 18?

useId is a hook for generating unique ID strings that are stable across server-side and client-side rendering, preventing hydration mismatch warnings for accessibility attributes (htmlFor, aria-describedby).

Key Takeaways
  • Generates unique, deterministic IDs for accessibility attributes.
  • Guarantees matching ID strings between SSR and client hydration.
Knowledge Check

What primary problem does the useId hook solve?