Interview Q&A / React
React interview questions
Rendering, state, hooks, keys and effects, explained with small examples.
Prefer rapid revision? Practise React short interview answers →
- What is the useId hook for, and why not use Math.random for IDs?
useId generates a stable unique ID that matches between server and client renders. It is meant for linking labels to inputs and aria attributes. Math.random changes each render and differs on the server, causing hydration mismatches.
IntermediateQuick answer1 min read