Skip to content
DevOps with Multi Cloud: new batch 25 Nov
novarynit: Training, Placement, Consulting

8 questions

React JS interview questions and answers

React questions for front-end and full stack roles: components, state, hooks and rendering.

What is the virtual DOM?
A lightweight copy of the page kept in memory. React compares the new virtual DOM with the previous one and updates only the parts of the real DOM that changed.
What is the difference between state and props?
Props are inputs passed from a parent and are read-only. State is data owned by the component that can change over time and causes a re-render when it does.
What does useEffect do?
It runs side effects such as data fetching or subscriptions after rendering. The dependency array controls when it runs again, and the returned function cleans up.
Why do list items need a key?
Keys let React match items between renders so it can reorder, add and remove efficiently and keep each item’s state. Keys should be stable and unique, not the array index when the list can change.
What is the difference between controlled and uncontrolled components?
A controlled input gets its value from React state and updates through onChange. An uncontrolled input keeps its own value in the DOM and is read with a ref.
What is prop drilling and how do you avoid it?
Passing props through many layers that do not use them. Context, component composition or a state library such as Redux or Zustand avoids it.
What are useMemo and useCallback for?
useMemo remembers a computed value and useCallback remembers a function between renders, so expensive work or child re-renders happen only when dependencies change.
What are the rules of hooks?
Call hooks only at the top level of a component or custom hook, never inside loops or conditions, and only from React functions.

More topics

Next step

Practise these in a mock interview

Sit in a free demo class first. We will call you back in 5 minutes

  • See a live class before you join
  • Meet the trainer and review the syllabus
  • Get a batch and timing that fits you
  • Ask about EMI and placement support

Where to learn

  • Ameerpet, Hyderabad

    3rd Floor, Green House, Ameerpet, Hyderabad, Telangana

  • Live online

    Join the same class from anywhere, ask questions live and get the same project reviews.

Request your free demo

Takes 30 seconds. No payment needed.

+91

Free · no obligation

Book your free demo class

Leave your number and we will call you back.

  1. We will call you back in 5 minutes
  2. Attend a free demo class
  3. Join only if you like it