❌

Normal view

15 React coding questions worth practicing before your next interview

I put together a list of React problems I kept seeing come up in interview prep β€” mix of core hooks, a couple of classic "build this component" asks, and a few that companies like Meta/Airbnb/Flipkart actually use. Figured I'd share instead of just keeping the list to myself.

Didn't want to just describe them β€” you can open each one and actually write + run the code against real tests in the browser, no setup. Links go straight to the problem.

1. Build a counter with three buttons. The classic warm-up β€” but the interesting part is making sure rapid clicks never lose an update.

Practice counter problem

2. Delay a value until the user stops typing. You've used this in every search box you've ever built β€” now write the hook yourself.

Practice this problem

  1. Track what a value used to be, one render ago. Small hook, but people trip over when it actually updates.

Practice usePrevious hook

  1. Model a shopping cart's add/remove/update-quantity logic. A good test of whether you reach for useReducer or keep fighting with useState.

Create shopping cart

  1. Build a traffic light that cycles red β†’ green β†’ yellow on its own timer. Looks simple until you have to get the timing and cleanup exactly right.

Create traffic light

6. Build a search box where slow responses can't overwrite fast ones. This is the one that trips almost everyone up the first time β€” asked at Airbnb.

Create search box

7. Render a comment thread with infinite nested replies. Recursion inside JSX β€” asked at Meta.

Build nested comment

8. Stop a long list from re-rendering every item on every keystroke elsewhere on the page. A real performance debugging exercise, not just a memo() one-liner.

Practice memoization

9. Give a callback prop a stable identity across renders. Sounds trivial, isn't β€” especially once a child component is memoized.

Stable callback

10. Build a modal where keyboard focus can't escape it. Accessibility question that separates "I use libraries" from "I understand the DOM."

Practice this problem

11. Write a fetch hook that won't re-request data it already has. Basically: build a tiny cache layer from scratch.

Build usecatche

12. Manage state for a multi-step form wizard. Back/next/jump-to-step, without the state turning into spaghetti.

Multi-step form

13. Build an autocomplete search with keyboard-navigable suggestions. Filtering logic plus a surprisingly fiddly amount of UI state.

React auto-complete practice

14. Add undo/redo to a stateful app. Command-pattern state history β€” the kind of thing that's easy to describe and annoying to actually implement cleanly.

Undo/Redo Functionality

15. Build a month calendar grid that handles real date math. Leap years, month boundaries, the works β€” asked at Flipkart.

Build calendar grid

submitted by /u/Ok_Resolve_9157 to r/reactjs
[link] [comments]
❌