Upgrade to Pro — share decks privately, control downloads, hide ads and more …

React Server Components: Elevating Speed, Inter...

Aurora Scharff
January 22, 2025
0

React Server Components: Elevating Speed, Interactivity, and User Experience

React Server Components offer an effective method for improving web app performance by rendering components on the server and streaming them to the client in real-time. This session will cover the functionality and benefits of React Server Components in context of Next.js, showing how they can increase application speed and responsiveness.

We’ll examine the role of asynchronous components, efficient data management, and modern React 19 features to improve load times and interactivity, while also measuring web vitals with Lighthouse to track performance improvements. With real-world examples and practical advice, you'll learn how to integrate these components to enhance your web app’s performance and provide a better user experience.

Aurora Scharff

January 22, 2025
Tweet

Transcript

  1. Introduction > Aurora Scharff > Norway, Oslo > Consultant at

    Crayon Consulting > Microsoft MVP in web dev > Active RSC developer with Next.js App Router
  2. React Server Components Fetch data asynchronously RSCs can be async

    and fetch their own data asynchronously right inside the component itself. Access backend resources RSCs are run only on the server and can therefore access backend resources directly. Reduce bundle size RSCs’ JavaScript is never shipped to the client and reduce the bundle size to build more performant apps.
  3. Render RSCs on the server and stream each component down

    to the client as they complete, while displaying a loading fallback with Suspense. Streaming RSCs with Suspense
  4. Resolve promises deep in the tree and display appropriate loading

    fallbacks to increase performance and UX Best practice development patterns
  5. Best practice development patterns Resolve promises deep in the tree

    and display appropriate loading fallbacks to increase performance and UX Display pending indicators to give immediate interaction feedback
  6. Best practice development patterns Resolve promises deep in the tree

    and display appropriate loading fallbacks to increase performance and UX Display pending indicators to give immediate interaction feedback Put state in the URL as a single source of truth to allow the app to be reloaded, bookmarked or shared effectively
  7. Best practice development patterns Resolve promises deep in the tree

    and display appropriate loading fallbacks to increase performance and UX Display pending indicators to give immediate interaction feedback Put state in the URL as a single source of truth to allow the app to be reloaded, bookmarked or shared effectively Progressively enhance to ensure your app is functional even before hydration has completed
  8. Utilize React 19 features cache() - Perform per-render caching for

    expensive function calls. useOptimistic() - Respond to user interactions instantly even when the following request is slow. useFormStatus() - Display information about the latest form submission. use() - Suspend client components as they resolve a promise passed down. Enable Next.js features staleTimes - Set stales times for dynamic page segments to reuse them across subsequent requests. Partial Prerendering (experimental) - Statically render parts of the page or layout to improve performance. Tools
  9. Tools Utilize React 19 features cache() - Perform per-render caching

    for expensive function calls. useOptimistic() - Respond to user interactions instantly even when the following request is slow. useFormStatus() - Display information about the latest form submission. use() - Suspend client components as they resolve a promise passed down. Enable Next.js features staleTimes - Set stales times for dynamic page segments to reuse them across subsequent requests. Partial Prerendering (experimental) - Statically render parts of the page or layout to improve performance.