โšกLearnIT
Interview ยท Topic 21

โž•Important Additions You Should Know

Things we didn't cover explicitly, but that come up constantly in 2025โ€“2026 frontend interviews and real work. These fill the gaps.

21.1React Server Components (RSC) & the App Router

The biggest shift in React in years. In Next.js App Router (and React 19), components are Server Components by default.

  • Server Components run only on the server, can be async, can fetch data and hit the DB directly, and ship zero JavaScript to the client. They can't use state or effects or browser APIs.
  • Client Components (opt in with 'use client' at the top of the file) are the interactive ones โ€” state, effects, event handlers, browser APIs. They ship JS as usual.
  • The pattern: keep most of the tree as Server Components (data + static markup); push interactivity to small Client Component leaves. This shrinks the JS bundle dramatically and improves LCP/INP.
  • Server Actions โ€” call server functions directly from components (form submissions, mutations) without hand-writing API routes.
  • Streaming + Suspense โ€” the server can stream HTML as it's ready; <Suspense> boundaries show fallbacks while slower parts load.

If asked "what's new in React/Next" or "how would you reduce bundle size in a modern app," RSC is the headline answer.

21.2Server state vs client state (a distinction interviewers expect)

  • Client state โ€” UI state you own: form inputs, toggles, selected tab, modal open. Tools: useState, Zustand, Context.
  • Server state โ€” data that lives on a server, you cache a copy: users, tickets, products. It's asynchronous, shared, and can go stale. Tools: react-query / SWR โ€” purpose-built for it (caching, revalidation, dedup, retries).

The classic mistake: dumping server data into Redux/Zustand and hand-managing loading/error/staleness. Modern answer: react-query for server state, a light client-state tool for the rest. Saying this signals current, senior-level thinking.

21.3Testing strategy

  • The testing trophy (Kent C. Dodds' model, dominant in frontend): mostly integration tests, fewer unit and E2E, with static analysis (TS + ESLint) as the base. Integration tests give the most confidence per effort.
  • Unit โ€” pure functions, hooks (via @testing-library/react-hooks / renderHook).
  • Integration/component โ€” React Testing Library: test behavior the user sees (query by role/label/text), not implementation details. "Does clicking filter show the right rows?" not "is this state variable set?"
  • E2E โ€” Playwright (modern favorite) or Cypress: real browser, critical user flows (login, checkout).
  • Visual regression โ€” Chromatic/Percy for design-system components.
  • Accessibility โ€” axe-core in tests.
  • Mocking network โ€” MSW (Mock Service Worker) intercepts at the network layer, so tests exercise real fetch code.

RTL guiding principle: "The more your tests resemble the way your software is used, the more confidence they give you."

21.4Accessibility (a11y) essentials

  • Semantic HTML first โ€” <button>, <nav>, <main>, <label>. A <div onClick> is not a button (no keyboard, no role).
  • Keyboard operability โ€” every interactive element reachable and operable via keyboard; visible focus states; logical tab order; focus management in modals (trap focus, restore on close).
  • ARIA only when semantic HTML can't express it โ€” and correctly (bad ARIA is worse than none). aria-label, aria-describedby, aria-live for dynamic announcements.
  • Color contrast โ€” WCAG AA: 4.5:1 for normal text, 3:1 for large text.
  • Images โ€” meaningful alt; decorative images alt="".
  • Test โ€” keyboard-only pass, a screen reader (VoiceOver/NVDA), axe DevTools. It's also increasingly a legal requirement, not just nice-to-have.

21.5CSS & styling approaches (know the trade-offs)

  • Tailwind (utility-first) โ€” fast, consistent via tokens, no naming/dead-CSS problems, small production CSS (purged). Downside: verbose class strings. Your stack uses this.
  • CSS Modules โ€” scoped class names, plain CSS, zero runtime.
  • CSS-in-JS (styled-components/Emotion) โ€” dynamic styling in JS; but runtime cost and RSC-incompatibility have pushed the ecosystem away from runtime CSS-in-JS.
  • Zero-runtime CSS-in-JS (Vanilla Extract, Linaria) โ€” type-safe styles extracted to static CSS at build time; RSC-friendly. The modern direction.
  • Container queries โ€” style based on a container's size, not just the viewport โ€” a big recent capability for truly reusable responsive components.

21.6Build tooling

  • Vite โ€” the modern default for SPAs: native ESM dev server (instant start, fast HMR), Rollup for production. Largely replaced Create React App (which is deprecated).
  • Webpack โ€” still everywhere, still the Module Federation backbone; more config-heavy.
  • esbuild / SWC โ€” Go/Rust-based transpilers that made builds an order of magnitude faster (Next.js uses SWC).
  • Turbopack โ€” Vercel's Rust successor to Webpack, used in Next.js dev.
  • Tree shaking โ€” dead-code elimination; relies on ES modules and side-effect-free code ("sideEffects": false in package.json). Prefer named ESM imports so bundlers can drop unused code.

21.7Rendering perf details worth having in your pocket

  • key on siblings to force remount when identity truly changes (e.g., re-init a component when the route param changes).
  • State colocation โ€” keep state as low in the tree as possible; lifting it unnecessarily causes wide re-renders.
  • Composition to avoid re-renders โ€” passing children as props (<Layout>{expensiveChildren}</Layout>) means the expensive children don't re-render when Layout's own state changes.
  • useMemo for referential stability of objects/arrays passed to memoized children or dependency arrays โ€” not just for expensive math.
  • Avoid anonymous components defined inside render (they remount every render).

21.8Progressive Web Apps & offline (brief)

Service workers (cache strategies, offline support, background sync), Web App Manifest (installable), push notifications. Relevant if a role mentions offline/mobile-web.

๐Ÿง  Quiz: Important Additions You Should Know

2 questions

1React Server Components (RSC) primarily let you:

2A key distinction interviewers expect is between:

Answered 0/2