01 / 03

What is React?

It's a JavaScript library for building user interfaces. It allows developers to create reusable UI components that update efficiently and automatically when data changes. React follows a declarative approach, making it easier to manage the state of an application and render dynamic content.

The major features of ReactJS are as follows:
  1. 1

    It uses VirtualDOM.

  2. 2

    Follows Unidirectional data flow or data binding

  3. 3

    Uses reusable/composable UI components to develop the view

  4. 4

    Increases the application’s performance with Virtual DOM

  5. 5

    JSX makes code easy to read and write

  6. 6

    It renders both on client and server side

  7. 7

    Easy to integrate with other frameworks (Angular, BackboneJS) since it is only a view library

  8. 8

    Easy to write UI Test cases and integration with tools such as JEST.

Difficulty: 4/10
Topics: component model, state & lifecycle, virtual DOM

Scenario Questions

0-2 years experience
  1. 1

    If you need to display a list of items fetched from an API in a React component, how would you set it up?

  2. 2

    What happens when you update a component's state using setState? Walk me through the rendering process.

2-5 years experience
  1. 1

    We have a component that sometimes fails to re‑render after its props change. How would you debug the issue?

  2. 2

    When adding a new feature, you must choose between a class component and a functional component with hooks. What trade‑offs would you consider?

5-8 years experience
  1. 1

    Our app experiences performance lag when rendering a large table. How would you optimize the React rendering pipeline?

  2. 2

    We need to share state across many unrelated components. Which patterns would you choose and why?

8+ years experience
  1. 1

    We are planning to migrate a legacy codebase from class components to functional components with hooks across multiple teams. How would you approach the migration to minimize risk?

  2. 2

    How would you design a component library that will be used by several product lines, ensuring consistency, versioning, and testability?

Follow-up Questions

  • Can you give a concrete example of a component you built?
  • What common pitfalls should developers watch out for when using state?
  • How do you decide between class components and hooks in a new feature?