nextRound
TechnologiesCoding ProblemsBookmarksLearning PathsLogin
nextRound
TechnologiesCoding ProblemsBookmarksLearning PathsLogin
Questions
4 of 4
1What is the purpose of the `useState` hook in React?
2What if we call set function multiple times in a function?
3What is the correct way of passing the initialiser function to useState?
4List some good practices while using state
reactreact
Basics
JSX
Virtual DOM
Reconciliation
State and Props
Components
Class Components
Function Components
Lifecycle functions
Code Sharing
Hooks
useState
useReducer
useMemo
useContext
useCallback
useEffect
Custom Hooks
New Hooks
HOC
Refs
Data Sharing
Events
Context API
Redux
Router
CSR-SSR
React APIs
Performance Optimisation
ReactDOM
Strict Mode
Security
04 / 04
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Mock Interviews
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

List some good practices while using state

Difficulty: 5/10
state immutability, lifting state, global state management
  1. 1

    If the value you need can be computed entirely from the current props or other state, remove that redundant state altogether.

  2. 2

    If you’re worried about recomputing too often, the useMemo Hook can help.

  3. 3

    If you want to reset the entire component tree’s state, pass a different key to your component.

  4. 4

    If you can, update all the relevant state in the event handlers.

Scenario Questions

0-2 years experience

  1. 1How would you initialize a piece of state that depends on a prop value, and why would you choose that approach?
  2. 2If you notice a component re‑rendering twice after a button click that updates state, what could be causing it and how would you fix it?
  3. 3When you need to update an object in state, how would you do it to avoid mutating the original state?

2-5 years experience

  1. 1You’re adding a form with multiple input fields that share validation state. How would you structure the state, and what trade‑offs does your approach have?
  2. 2During a sprint you discover that a component’s state is causing a memory leak when a subscription isn’t cleaned up. Walk me through how you’d debug and resolve it.
  3. 3Explain why lifting state up to a parent caused a performance regression in a list component, and how you’d address it.

5-8 years experience

  1. 1Our dashboard renders thousands of rows with per‑row expand/collapse state. How would you design the state management to keep the UI responsive?
  2. 2We’re migrating from local component state to a global store. What criteria would you use to decide which pieces of state to move, and how would you ensure consistency?
  3. 3Describe how you’d prevent unnecessary re‑renders when multiple components read the same slice of state, considering memoization and selector patterns.

8+ years experience

  1. 1Across several teams we have duplicated state handling logic for feature toggles. How would you create a shared, scalable solution while minimizing coupling?
  2. 2Our legacy codebase mixes class component state, Redux, and React Context. Outline a migration plan to unify state management, addressing backward compatibility and developer onboarding.
  3. 3When designing a library of reusable UI components, what conventions would you enforce for internal state vs. controlled props to ensure composability and testability?

Follow-up Questions

  • Can you give an example of a bug you’ve seen caused by mutating state?
  • How do you decide when to move state to a context versus a Redux store?
  • What tools do you use to detect unnecessary re‑renders?
Sharethis question

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.