React DOM, SSR, Hydration, RSC, and React 19 Questions
1. What does createRoot do?β
Strong answer: It creates a React client root for a DOM container so React can render and manage a component tree there.
2. createRoot vs hydrateRoot?β
Strong answer: createRoot starts a client-rendered root. hydrateRoot attaches React behavior to HTML that was already generated by React on the server.
3. What is hydration?β
Strong answer: Hydration is the client process of attaching React to server-rendered HTML while preserving the existing DOM and making the tree interactive.
4. What causes hydration mismatches?β
Strong answer: Server and client initial renders produce different output due to time/random values, browser-only data, inconsistent fetched data, locale differences, invalid nesting, or conditional rendering that differs across environments.
5. Why are hydration mismatches important?β
Strong answer: They can cause warnings, discarded server output, lost performance benefits, UI flicker, incorrect event attachment, or recoverable errors that should be observed in production.
6. How do you debug a hydration mismatch?β
Strong answer: Compare server vs initial client data/output, inspect time/random/browser-only branches, check HTML validity, use hydration error telemetry, source maps, release correlation, and narrow to the smallest mismatching boundary.
7. What is identifierPrefix?β
Strong answer: A root option used to prefix IDs generated by useId, helping avoid collisions when multiple roots render on the same page.
8. What are onCaughtError, onUncaughtError, and onRecoverableError?β
Strong answer: Root-level callbacks for errors caught by Error Boundaries, uncaught render errors, and errors React recovers from, respectively. They support production observability.
9. What is a portal?β
Strong answer: createPortal renders host content into another DOM container while keeping the content in the same React tree for context and React event propagation.
10. Common portal use cases?β
Strong answer: Dialogs, overlays, tooltips, floating menus, and integration with DOM containers outside normal layout/stacking contexts.
11. What is flushSync?β
Strong answer: An escape hatch that forces React to synchronously flush updates so the DOM is updated before code immediately after it runs. It should be rare because it can hurt performance and interfere with Suspense behavior.
12. When might flushSync be justified?β
Strong answer: Integration with browser or third-party APIs that require the DOM to reflect an update synchronously before the next imperative step.
13. What are resource hint APIs such as preload and preconnect for?β
Strong answer: They let React coordinate browser resource loading earlierβDNS, connections, scripts, styles, modules, and other resourcesβto reduce critical-path latency.
14. CSR vs SSR?β
Strong answer: CSR creates initial UI primarily in the browser. SSR generates initial HTML on the server, then may hydrate on the client for interactivity.
15. What benefits can SSR provide?β
Strong answer: Earlier meaningful HTML, SEO/crawler compatibility, improved initial rendering in some network/device conditions, and integration with server data loading. It also adds server cost and hydration complexity.
16. What are SSR trade-offs?β
Strong answer: Server infrastructure, request latency, hydration cost, cache complexity, environment differences, serialization/security boundaries, and operational complexity.
17. What is streaming SSR?β
Strong answer: The server sends HTML progressively as parts of the React tree become ready instead of waiting for the whole page to complete before sending anything.
18. renderToPipeableStream vs renderToReadableStream?β
Strong answer: Both support streaming server rendering; the former fits Node-style streams, while the latter uses Web Streams for runtimes supporting that model.
19. What is the βshellβ in streaming SSR?β
Strong answer: The initial application structure that can be sent before all Suspense content is ready, allowing the browser to start receiving/rendering earlier.
20. Why do Suspense boundaries matter for streaming SSR?β
Strong answer: They define places where the shell can show fallbacks while slower content is streamed later, enabling progressive reveal.
21. What is static rendering/prerendering?β
Strong answer: Rendering HTML ahead of request time or as a static-generation process rather than producing the full response per user request.
22. What is Partial Pre-rendering conceptually?β
Strong answer: Build or generate a static shell while preserving deferred dynamic sections that can be resumed/rendered later, combining static delivery with dynamic content boundaries.
23. What are prerender and prerenderToNodeStream?β
Strong answer: React DOM static APIs for prerendering content, with Web Stream and Node Stream variants.
24. What are resume APIs for?β
Strong answer: They continue rendering from postponed state produced by an earlier partial/static rendering process, supporting PPR-like architectures.
25. What is a React Server Component?β
Strong answer: A component that executes in a server environment and can access server-only data/dependencies, produce component output for the client tree, and avoid shipping its own component code to the browser.
26. RSC vs SSR?β
Strong answer: SSR describes rendering React output to HTML for initial delivery. RSC describes a component execution/data model where some components run only on the server and their serialized result is integrated with Client Components. They can be used together but are different concepts.
27. Can a Server Component use useState?β
Strong answer: Not for interactive client state. Server Components do not run as interactive browser component instances; interactive state belongs in Client Components.
28. Can Server Components be async?β
Strong answer: Yes, framework/RSC environments allow async Server Components to await server-side data/dependencies.
29. What does 'use client' mean?β
Strong answer: It marks a module as a client boundary. That module and its transitive client-side dependency graph are intended to execute in the client environment.
30. Does 'use client' mean every child must be a Client Component?β
Strong answer: No. A Client Component can receive Server Component output through props/children. The directive defines a module boundary, not a rule that every rendered descendant must be client code.
31. What can cross from Server to Client Component props?β
Strong answer: Serializable values supported by the RSC protocol/framework. Server-only resources and arbitrary non-serializable runtime objects cannot simply cross the boundary.
32. What is a Server Function?β
Strong answer: A function defined for server execution that the framework can expose to client code through a serialized reference, often used for mutations/Actions.
33. What does 'use server' mean?β
Strong answer: It marks async functions/module exports as Server Functions callable through the framework's server-function mechanism. It is not a marker meaning βthis is a Server Component.β
34. Why are Server Function arguments untrusted?β
Strong answer: The client controls the request. Types and UI restrictions do not create authority. Validate, authenticate, authorize, and scope every mutation on the server.
35. Should 'use server' be used primarily for data fetching?β
Strong answer: The documented direction is Server Functions for operations invoked from clients, especially mutations. Server Components themselves can fetch/read server data directly; do not create network round trips unnecessarily.
36. How do Server Functions integrate with forms?β
Strong answer: A Server Function can be used as a form Action in compatible frameworks, allowing native form semantics, pending UI, Action state, and progressive enhancement patterns.
37. What is cache in React RSC?β
Strong answer: cache(fn) memoizes a function for the server-rendering/request context so repeated calls with matching arguments can reuse the result.
38. Is React cache a persistent Redis/CDN cache?β
Strong answer: No. It is a React request/render-scoped memoization facility, not a replacement for application or infrastructure caching.
39. Why does argument identity matter with cache?β
Strong answer: Cache lookup depends on argument equality/identity semantics. Recreating object arguments can prevent reuse even if contents look the same.
40. What is cacheSignal?β
Strong answer: A React 19.2 RSC API returning an AbortSignal tied to the lifetime of React's cache/render work, useful for cancelling abortable server work when that lifetime ends.
41. What is use?β
Strong answer: A React API that reads a resource such as a Promise or Context in supported environments. Reading a pending Promise can suspend the component.
42. How is use different from ordinary Hooks?β
Strong answer: use has special call rules and may be called conditionally or in loops, but it still must be used in React render contexts and has restrictions such as not being wrapped in try/catch for suspended Promise handling.
43. What are Actions in React 19?β
Strong answer: A pattern for async transitions/mutations that integrates pending state, forms, optimistic UI, and mutation results with React's update model.
44. What changed about refs in React 19?β
Strong answer: Function components can receive ref as a prop, reducing the need for forwardRef in new code.
45. What changed about Context providers in React 19?β
Strong answer: The Context object itself can be used as the provider component with a value prop.
46. What is <Activity>?β
Strong answer: React 19.2's built-in component for hiding/showing/prioritizing a subtree while preserving useful state/structure according to its mode rather than simply conditionally unmounting it.
47. What is useEffectEvent?β
Strong answer: React 19.2 Hook for non-reactive event-like logic invoked from Effects while reading latest committed values.
48. What are React Performance Tracks?β
Strong answer: React 19.2 performance tooling that exposes scheduler/component/server React work in performance traces for diagnosis.
49. What React 19 APIs were removed or deprecated?β
Strong answer: Examples include old ReactDOM.render, hydrate, unmountComponentAtNode, findDOMNode, string refs, legacy Context APIs, createFactory, older server stream APIs, and deprecated test-renderer directions. New code should use modern roots, refs, Context, and testing approaches.
50. Is forwardRef removed?β
Strong answer: No. It remains available/important for existing code, but React 19 makes ref-as-prop the modern direction for function components.
51. What is the difference between framework responsibility and React core in RSC?β
Strong answer: React defines component/protocol primitives, but routing, bundling, request transport, cache invalidation, deployment, and many data-loading conventions are framework responsibilities.
52. Why should you avoid relying on private RSC bundler internals?β
Strong answer: The application-facing RSC model is stable in React 19, but lower-level framework/bundler implementation APIs do not necessarily carry the same minor-version compatibility guarantees.
53. Senior question: how do you choose CSR vs SSR vs static vs RSC?β
Strong answer: Start with requirements: personalization, SEO, time-to-content, data locality, interactivity, caching, infrastructure, deployment model, security, and team complexity. Use the minimum rendering architecture that satisfies the product constraints.
54. Senior question: how do you place Server/Client boundaries?β
Strong answer: Keep server-only data/dependencies and non-interactive composition on the server; move the smallest necessary interactive islands to client boundaries. Consider serialization, bundle cost, ownership, testing, and framework constraints.
55. Senior question: how would you observe an SSR/RSC production system?β
Strong answer: Correlate server request traces, render timings, stream milestones, hydration errors, root recoverable errors, client performance, releases, cache behavior, and mutation/server-function failures using shared request/release identifiers.