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 difference between state and props in React?
Props are inputs passed into a component by its parent and are read-only inside it. State is data a component owns and can change over time, and changing it makes the component re-render.
BeginnerIn-depth3 min read - How do you manage several form fields with a single state object?
Store the fields in one object and give each input a name attribute. One onChange handler reads e.target.name and e.target.value and updates that key with computed property syntax, copying the rest with spread.
BeginnerQuick answer1 min read - What does lifting state up mean in React?
When two sibling components need the same data, you move the state to their closest common parent and pass it down as props, along with callbacks to change it. This keeps one source of truth.
BeginnerQuick answer1 min read