JS Guide
HomeQuestionsSearchResources
Search

Built for developers preparing for JavaScript, React & TypeScript interviews.

ResourcesQuestionsSupport
HomeQuestionsSearchProgress
HomeQuestionsreact

react

React components, hooks, patterns, and best practices

Your Progress

0 of 8 completed

0%

8 Questions

senior Level
1
Explain React.memo, useMemo, and useCallback. When should each be used?
senior
performance
React.memo prevents component re-renders when props are unchanged. useMemo caches computed values. useCallback caches function references. Use them only when you have measured performance issues - premature optimization adds complexity without benefit.
2
How does React's reconciliation algorithm work?
senior
internals
Reconciliation is React's diffing algorithm that compares the new virtual DOM tree with the previous one to determine minimal DOM updates. It uses heuristics: different element types trigger full subtree replacement, keys identify items in lists, and same-type elements update attributes.
3
What are React's concurrent features and how do Suspense and transitions work?
senior
concurrent
Concurrent React enables interruptible rendering, allowing React to pause low-priority work for urgent updates. Suspense handles async loading states declaratively. useTransition marks updates as non-urgent, and useDeferredValue defers expensive re-renders.
4
How do Error Boundaries work in React and what are their limitations?
senior
error-handling
Error Boundaries are class components that catch JavaScript errors in their child component tree, log them, and display fallback UI. They don't catch errors in event handlers, async code, SSR, or errors thrown in the boundary itself.
5
Explain common React patterns: Compound Components, Render Props, and Custom Hooks.
senior
patterns
Compound Components share implicit state between related components (like <select>/<option>). Render Props pass render functions to share code. Custom Hooks extract reusable stateful logic. Today, Custom Hooks are preferred over Render Props for most cases.
6
What are Higher-Order Components (HOCs) in React, and why are they less commonly used today?
senior
patterns
A Higher-Order Component is a function that takes a component and returns an enhanced component with additional props or behavior; they're less common now because React Hooks provide a cleaner solution for logic reuse without wrapper components.
7
What is Redux and Redux Thunk, and how do they manage application state and async operations?
senior
state-management
Redux is a predictable state container using a single store with pure reducer functions; Redux Thunk is middleware that enables async logic by allowing action creators to return functions that can dispatch actions and access state.
8
What security vulnerabilities should you address in React applications and how do you prevent them?
senior
security
Key vulnerabilities include XSS (mitigated by React's auto-escaping, but watch dangerouslySetInnerHTML and URL injection), CSRF (use tokens in API requests, SameSite cookies), and insecure storage (avoid localStorage for sensitive data, prefer httpOnly cookies).