HomebaseWorks

React interview questions

Common React questions that check whether you understand rendering and hooks rather than only their syntax.

EWritten by the HomebaseWorks editorial team · reviewed 26 Oct 2026
1
What is the difference between props and state?

Props are inputs a component receives from its parent and does not change. State is data the component owns and updates with a setter, which triggers a re-render. For example, a ProductCard gets the product as a prop, while a quantity picker inside it keeps the chosen quantity in state.

2
Why does my state still show the old value right after I call the setter?

The setter schedules a new render; it does not change the variable in the current one. The current function call keeps its snapshot. If I need the new value straight away I compute it into a local variable first, and if the update depends on the previous value I use the updater form.

3
When would you use useEffect, and when would you avoid it?

I use it to sync with something outside React, such as fetching data, subscribing to events or starting a timer, and I return a cleanup. I avoid it for deriving values from props or state, because those can be calculated during render without an extra render pass.

Advertisement
4
Why are keys important in lists?

Keys let React match items between renders so it can keep their state and DOM nodes. If I use the index and the list is sorted or filtered, state can stay at a position rather than with the item. I use a stable id from the data.

5
How do you share state between two components that are not parent and child?

First I lift it to their nearest common parent and pass it down. If many levels in between only pass it along, I consider context for that value. I reach for a separate state library only when the app has a lot of shared, frequently changing state.

6
How would you find and fix a slow component?

I measure first with the React profiler to see which components render often or take long. Typical fixes are moving state closer to where it is used, memoising an expensive calculation with useMemo, or wrapping a heavy child in React.memo with stable props. I avoid adding memoisation everywhere without evidence.

Practise out loud. Say each answer once as written, then again in your own words with your own number or story.

Have a number ready. "My React score is at benchmark on a timed test" is a stronger answer than "I am good at it". Take the test and quote the result.

Advertisement
Continue with React4 lessons · 1 interview set · 1 test · 1 certificate
Not tested

More in Web and app