- React
- Live Machine Coding Challenges and Custom Hooks
React Machine Coding Interview Questions
React machine coding interview questions evaluate your ability to translate product requirements into clean, modular, and accessible React components under time constraints.
Build essential interview utilities and UI widgets from scratch: production-grade useDebounce and usePrevious hooks, an accessible Star Rating widget, an accessible Modal Dialog with focus trapping, compound Tabs, a debounced Autocomplete typeahead, and an Infinite Scroll component with IntersectionObserver.
React Machine Coding Interview Questions: 8 lessons
Machine Coding: useDebounce & useThrottle Hooks
useDebounce and useThrottle custom hooks for React machine coding: delay a value until changes stop, and cancel the previous timer in effect cleanup. useThrottle ensures an action executes at most once per time window using useRef to track timestamps or trailing timers.
Machine Coding: usePrevious & useIsMounted Hooks
React Machine Coding: usePrevious uses a mutable useRef to return the value from the preceding render pass before updating the ref in useEffect. useIsMounted returns a boolean callback indicating whether the component is currently mounted, preventing state updates after unmount.
Machine Coding: Accessible Star Rating Widget
An accessible Star Rating widget requires managing hover and selected states, full keyboard navigation with Arrow keys and Home/End, ARIA radiogroup semantics with role="radiogroup" and aria-checked, and dynamic visual state updates without DOM manipulation.
Machine Coding: Production Modal Dialog Component
A production React modal dialog uses createPortal to escape parent stacking contexts, traps keyboard Tab focus, dismisses on Escape key or backdrop click, restores focus to the triggering element on unmount, and locks background document scrolling.
Machine Coding: Accessible Tabs Compound Component
React Machine Coding: the Accessible Tabs compound component shares active tab state via React Context between Tabs, TabList, Tab, and TabPanel. It adheres to WAI-ARIA Tabs pattern using role="tablist", role="tab", role="tabpanel", aria-selected, and keyboard arrow key navigation with roving tabindex.
Machine Coding: Autocomplete Typeahead Search
A production React autocomplete typeahead features debounced asynchronous fetching, in-memory caching to eliminate duplicate API requests, full keyboard navigation (ArrowDown, ArrowUp, Enter, Escape), WAI-ARIA combobox accessibility, and click-outside dismissal via ref.
Machine Coding: Infinite Scroll with Observer
React Machine Coding: production infinite scroll uses the IntersectionObserver API attached to a sentinel element at the bottom of the list. When the sentinel enters the viewport, it triggers the next page fetch while managing loading flags, error retries, and disconnecting the observer on unmount.
Machine Coding: Multi-Step Wizard with Validation
A production Multi-Step Form Wizard manages step navigation as a finite state machine, persists accumulated form data across steps, isolates field validation per step, supports backward navigation without data loss, and submits a consolidated payload upon final review.
