React ⚑ Recently updatedUpdated on Jun 30, 2026 β€” this content may still be evolving.

React: Revision Sheet

One-page rapid review. Night before interview.

JSX Essentials

{condition && <Component />}
{a ? <A /> : <B />}
<>{multiple}{elements}</>

useState

const [x, setX] = useState(initial);
setX(prev => prev + 1);  // functional update

useEffect

useEffect(() => {
  // side effect
  return () => { /* cleanup */ };
}, [dep1, dep2]);  // [] = mount only

Don’t: sync derived state, respond to clicks

useRef

DOM access + mutable values without re-render.

useContext

createContext β†’ Provider β†’ useContext β€” avoid overuse.

useMemo / useCallback

  • useMemo(() => compute(a), [a]) β€” cache value
  • useCallback(() => fn(), [deps]) β€” cache function

useReducer

(state, action) => newState β€” complex state transitions.

Rules of Hooks

Top level only. React functions or custom hooks only.

Re-render Triggers

State change, parent re-render, context change.

React.memo

Skip re-render if props shallow-equal.

Keys

Stable unique id β€” not index for dynamic lists.

Controlled Input

<input value={v} onChange={e => setV(e.target.value)} />

Fetch Pattern

Loading + error + empty + abort controller.

Lifting State

Share state at lowest common ancestor.

Code Splitting

const Page = lazy(() => import('./Page'));
<Suspense fallback={...}><Page /></Suspense>

Virtual DOM

Reconciliation β€” diff old vs new virtual tree, update real DOM minimally.

Props vs State

  • Props: passed in, read-only
  • State: internal, triggers re-render

Children Prop

<Card>{content}</Card>
// props.children inside Card

Custom Hooks

function useX() { ... } β€” extract reusable logic.

Quick Answers

QuestionAnswer
Why keys?Identity for reconciliation
Strict Mode double effect?Intentional dev check
Context perf issue?All consumers re-render
Error boundary catches?Render errors, not event/async
When useReducer?Complex multi-field state

Red Flags

  • Mutating state
  • Missing effect deps
  • Index keys on sortable list
  • Fetch without loading/error
  • Hooks in conditions