Higher-order components wrap behavior, while controlled and uncontrolled components describe where important state lives.
- HOCs enhance components via composition
- Controlled components receive value and change handlers from state
- Good components stay predictable and testable
Before hooks, HOCs and render props were common ways to share stateful logic across components.
- HOCs wrap components
- Render props pass behavior through a function prop
- Hooks usually make logic reuse flatter and cleaner
Hooks let function components use stateful and lifecycle-like logic without classes, but they have strict usage rules.
- Hooks improved logic reuse in function components
- Call hooks at the top level
- Do not call hooks inside loops, conditions, or nested functions
JSX is a syntax extension that lets React developers describe UI trees inside JavaScript more readably.
- JSX looks HTML-like
- It is optional but common
- It compiles to React element creation calls
JSX has a few important rules around single roots, expressions, fragments, and rendering arrays of elements.
- Components must return one parent or a fragment
- Expressions work in curly braces
- Statements do not go directly inside JSX
React uses keys to identify list items across renders so reconciliation can preserve identity correctly.
- Keys must be stable and unique within the list
- Indexes can break identity when order changes
- Keys affect correctness as well as performance
The must-know React interview set revolves around React basics, JSX, props, state, hooks, keys, reconciliation, Context, Redux, routing, data fetching, lazy loading, Suspense, error boundaries, StrictMode, SSR vs CSR, hydration, and performance.
- Know the definitions first
- Know the trade-offs second
- Tie answers back to real component behavior
Next.js builds on React by adding routing, rendering strategies, data-loading patterns, and production-focused conventions.
- Next.js is a React framework
- Supports SSR, SSG, and ISR out of the box
- Adds features like file-based routing and API routes
Initial render and later re-renders follow different triggers, and where state lives strongly affects how much of the tree must update.
- Parents can re-render children indirectly
- State colocation reduces blast radius
- Not every re-render is a bug
React props can carry values, callbacks, children, and even JSX, but deep prop chains can become hard to manage.
- Functions can be passed as props
- `children` enables composition
- Prop drilling can signal a state-sharing design issue
Props are read-only inputs from a parent, while state is data the component manages and can change over time.
- Props flow downward
- Props are not mutated by the child
- State changes trigger re-renders
React architecture questions test how you organize real applications rather than isolated component syntax.
- Folder structure should reflect scale and team needs
- API calls need clear ownership and state handling
- Protected routes and auth flows must integrate with navigation and data loading