Facebook Pixel

A React Interview Cheat Sheet of Concepts You Must Know

A quick cheat sheet of the React concepts you must know for interviews, with concise explanations.

A React Interview Cheat Sheet of Concepts You Must Know

A quick cheat sheet of the React concepts you must know for interviews, with concise explanations.

JSX

JSX compiles to React.createElement calls. Looks like HTML but is JavaScript. Use className, not class. Only expressions in curly braces, not statements.

Components

A component is a function that returns JSX. Names start with a capital letter. Props are read-only inputs. State is internal and triggers re-renders.

Hooks

Hooks let functional components use state and effects. Rules: top level only, only in React functions. Common: useState, useEffect, useRef, useContext, useReducer, useMemo, useCallback.

useState

Returns state and setter. Setter is async and batched. Pass a function for previous-value updates. Never mutate objects; replace with new copies.

useEffect

Runs side effects after render. Dependency array: empty runs on mount, with values runs on change, missing runs every render. Return a cleanup function for subscriptions and timers.

Virtual DOM and Reconciliation

React holds a virtual description of the UI, compares it to the previous one, and updates the real DOM only where they differ. This is reconciliation.

Keys

Stable, unique keys for list items so React tracks them across renders. Use id from data, not array index, for dynamic lists.

Performance

Profile first. useMemo for expensive values, useCallback for stable functions to memoized children, React.memo for components that re-render with same props. Virtualize long lists. Code split routes.

State Management

Local state for one component. Lift state for siblings. Context for widely-shared, rarely-changed data. Redux for complex, frequently-updated shared state. React Query for server state.

The Takeaway

Know this cheat sheet cold: JSX, components, hooks and their rules, useState, useEffect, virtual DOM and reconciliation, keys, performance with measurement, and state management by complexity. Each is a common interview topic.

JSX, components, hooks and their rules, useState and useEffect, the virtual DOM and reconciliation, keys for lists, performance with useMemo, useCallback, and React.memo, and state management by complexity, from local to Context to Redux.

Call hooks at the top level only, never in loops or conditions. Only call hooks from React functions. These rules exist because React tracks hooks by call order, and breaking the order causes subtle bugs.

It runs side effects after render. Dependency array: empty runs on mount, with values runs on change, missing runs every render. Return a cleanup function for subscriptions and timers to prevent leaks and stale updates.

React's in-memory description of the UI. It compares the new description to the previous one and updates the real DOM only where they differ, a process called reconciliation, which makes updates efficient.

Local state for one component, lift for siblings, Context for widely-shared rarely-changed data, Redux for complex frequently-updated shared state, and React Query for server state. Match the tool to the complexity, not by default.

Ready to master React completely?

Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course to dive deeper with high-quality video tutorials, solve interview questions, and a premium community.

Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.