Website Pricing Guide

Enter your email to get instant access to our website pricing guide.

React Server Components: The Future of React Development

August 28, 2024 by
React’s been a powerhouse for building web apps over the last ten years. We’ve all seen it evolve from those clunky class components to the elegance of hooks. But React Server Components (RSCs)? We don’t think anyone expected such a dramatic shift in how React worked. So, what exactly are React Server Components? How do […]


React’s been a powerhouse for building web apps over the last ten years.

We’ve all seen it evolve from those clunky class components to the elegance of hooks.

But React Server Components (RSCs)?

We don’t think anyone expected such a dramatic shift in how React worked.

So, what exactly are React Server Components? How do they work? And what do they do differently that React couldn’t already do?

To answer all these questions, we’ll quickly go over the fundamentals. If you’re in need of a refresher, have a quick look at this guide on how to learn React as a beginner.

In this post, we’ll walk you through why we needed React Server Components, how they work, and some of the major benefits of RSCs.

Let’s get started!

What Are React Server Components?

Tree Diagram Of React Server Components Shows The Hierarchy And Where Different Component Types Are Rendered In The App.
React Server Components: The Future Of React Development 26

Think of React Server Components as a new way of building React applications. Instead of running in the browser like typical React components, RSCs execute directly on your server.

“I think RSCs are designed to be the “componentization” of the back end, i.e., the back end equivalent of what SPA React did for the front end. In theory, they could largely eliminate the need for things like REST and GraphQL, leading to a much tighter integration between the server and client since a component could traverse the entire stack.” — ExternalBison54 on Reddit

Since RSCs execute directly on the server, they can efficiently access backend resources like databases and APIs without an additional data fetching layer.

DreamHost Glossary

API

An Application Programming Interface (API) is a set of functions enabling applications to access data and interact with external components, serving as a courier between client and server.

Read More

But why did we need RSCs anyway?

To answer this question, let’s rewind a bit.

Traditional React: Client-Side Rendering (CSR)

React has always been a client-side UI library.

The core idea behind React is to divide your entire design into smaller, independent units we call components. These components can manage their own private data (state) and pass data to each other (props).

Think of these components as JavaScript functions that download and run right in the user’s browser. When someone visits your app, their browser downloads all the component code, and React steps in to render everything:

Flowchart: Client-Side Rendering Workflow, From User Request To Page Load, Including Server Response And Browser Processing.
React Server Components: The Future Of React Development 27
  • The browser downloads the HTML, JavaScript, CSS, and other assets.
  • React analyzes the HTML, sets up event listeners for user interactions, and retrieves any required data.
  • The website transforms into a fully functional React application right before your eyes and everything is done by your browser and computer.

While this process works, it does have some downsides:

  • Slow load times: Loading times can be slow, particularly for complex applications with lots of components since now the user has to wait for everything to be downloaded first.
  • Bad for search engine optimization (SEO): The initial HTML is often barebones — just enough to download the JavaScript which then renders the rest of the code. This makes it hard for search engines to understand what the page is about.
  • Gets slower as apps grow larger: The client-side processing of JavaScript can strain resources, leading to a rougher user experience, especially as you add more functionality.

Get Content Delivered Straight to Your Inbox

Subscribe now to receive all the latest updates, delivered directly to your inbox.

The Next Iteration: Server-Side Rendering (SSR)

To address the issues caused by client-side rendering, the React community adopted Server-Side Rendering (SSR).

With SSR, the server handles rendering the code to HTML before sending it over.

This complete, rendered HTML is then transferred to your browser/mobile, ready to be viewed — the app doesn’t need to be compiled during runtime like it would without SSR.

Here’s how SSR works:

Diagram Showing How Server-Side Rendering Works, With Browser Requesting Html From Server And Receiving Fully Rendered Page.
React Server Components: The Future Of React Development 28
  • The server renders the initial HTML for each request.
  • The client receives a fully formed HTML structure, allowing for faster initial page loads.
  • The client then downloads React and your application code, a process called “hydration,” which makes the page interactive.

The HTML structure rendered on the server has no functionality — yet. 

React adds event listeners, sets up internal state management, and adds other functionality to the HTML after it’s been downloaded to your device. This process of adding “life” to the page is known as hydration.

Why does SSR work so well?

  1. Faster initial load times: Users see the content almost instantly because the browser receives fully formed HTML, eliminating the time required for the JavaScript to load and execute.
  2. Improved SEO: Search engines easily crawl and index server-rendered HTML. This direct access translates to better search engine optimization for your application.
  3. Enhanced performance on slower devices: SSR lightens the load on a user’s device. The server shoulders the work, making your application more accessible and performant, even on slower connections.

SSR, however, caused a number of additional problems, calling for an even better solution:

  • Slow Time to Interactive (TTI): Server-side rendering and hydration delay the user’s ability to see and interact with the app until the entire process is complete.
  • Server load: The server needs to do more work, further slowing down response times for complex applications, especially when there are many users simultaneously.
  • Setup complexity: Setting up and maintaining can be more complex, especially for large applications.

Finally, the React Server Components

In December 2020, the React team introduced the “Zero-Bundle-Size React Server Components” or RSCs.

This changed not only how we thought about building React apps but also how React apps work behind the scenes. RSCs solved many problems we had with CSR and SSR.

“With RSCs, React becomes a fully server-side framework and a fully client-side framework, which we’ve never had before. And that allows a much closer integration between the server and client code than was ever possible before.” — ExternalBison54 on Reddit

Let’s now look at the benefits that RSCs bring to the table:

1. Zero Bundle Size

RSCs are rendered entirely on the server, eliminating the need to send JavaScript code to the client. This results in:

  • Dramatically smaller JavaScript bundle sizes.
  • Faster page loads, particularly on slower networks.
  • Improved performance on less powerful devices.

Unlike SSR, where the entire React component tree is sent to the client for hydration, RSCs keep server-only code on the server. This leads to those significantly smaller client-side bundles we talked about, making your applications lighter and more responsive.

2. Direct Backend Access

RSCs can interact directly with databases and file systems without requiring an API layer.

As you can see in the code below, the courses variable is fetched directly from the database, and the UI prints a list of the course.id and course.name from the courses.map:

async function CourseList() {
  const db = await connectToDatabase();
  const courses = await db.query('SELECT * FROM courses');

  return (
   

          {courses.map(course => (
           
  • {course.name}
  •       ))}
       

  );
}

This is simpler in contrast to traditional SSR where you’d need to set up separate API routes for fetching individual pieces of data.

3. Automatic Code Splitting

With RSCs, you also get more granular code splitting and better code organization.

React keeps server-only code on the server and ensures that it never gets sent over to the client. The client components are automatically identified and sent to the client for hydration.

And the overall bundle becomes extremely optimized since the client now receives exactly what’s needed for a fully functional app.

On the other hand, SSR needs careful manual code splitting to optimize performance for each additional page.

4. Reduced Waterfall Effect and Streaming Rendering

React Server Components combine streaming rendering and parallel data fetching. This powerful combination significantly reduces the “waterfall effect” often seen in traditional server-side rendering.

Waterfall Effect

The “waterfall effect” slows down web development. Basically, it forces the operations to follow one another as if a waterfall were flowing over a series of rocks.

Each step must wait for the previous one to finish. This “wait” is especially noticeable in data fetching. One API call must be completed before the next one begins, causing page load times to slow.

Table From Chrome Network Tab Displays The Waterfall Effect Of Network Requests, Showing Various Api Calls And Their Timing.
React Server Components: The Future Of React Development 29

Streaming Rendering

Streaming rendering offers a solution. Instead of waiting for the entire page to render on the server, the server can send pieces of the UI to the client as soon as they’re ready.

Diagram Shows Streaming Server Rendering: Network Requests And Javascript Execution Timeline, Including Fcp And Tti Markers.
React Server Components: The Future Of React Development 30

React Server Components make rendering and fetching data much smoother. It creates multiple server components that work in parallel avoiding this waterfall effect.

The server starts sending HTML to the client the moment any piece of the UI is ready.

So, compared to server-side rendering, RSCs:

  • Allow each component to fetch its data independently and in parallel.
  • The server can stream a component as soon as its data is ready, without waiting for other components to catch up.
  • Users see the content loading one after the other, enhancing their perception of performance.

5. Smooth Interaction With Client Components

Now, using RSCs doesn’t necessarily imply that you have to skip using client-side components. 

Both components can co-exist and help you create a great overall app experience.

Think of an e-commerce application. With SSR, the entire app needs to be rendered server side.

In RSCs, however, you can select which components to render on the server and which ones to render on the client side.

For instance, you could use server components to fetch product data and render the initial product listing page.

Then, client components can handle user interactions like adding items to a shopping cart or managing product reviews.

Should You Add RSC Implementation on Your Roadmap?

Our verdict? RSCs add a lot of value to React development.

They solve some of the most pressing problems with the SSR and CSR approaches: performance, data fetching, and developer experience. For developers just starting out with coding, this has made life easier.

Now, should you add RSC implementation to your roadmap? We’ll have to go with the dreaded — it depends.

Your app may be working perfectly fine without RSCs. And in this case, adding another layer of abstraction may not do much. However, if you plan to scale, and think RSCs can improve the user experience for your app, try making small changes and scaling from there.

And if you need a powerful server to test RSCs, spin up a DreamHost VPS.

DreamHost offers a fully managed VPS service where you can deploy even your most demanding apps without worrying about maintaining the server.

VPS Hosting

VPS Hosting

We Know You’ve Got Lots of VPS Options

Here’s how DreamHost’s VPS offering stands apart: 24/7 customer support, an intuitive panel, scalable RAM, unlimited bandwidth, unlimited hosting domains, and SSD storage.

Change Your VPS Plan

Ian is a Product Designer based in Los Angeles, California. He is responsible for driving brand and product design at DreamHost, developing and maintaining our internal design system, and writing frontend code when he can. In his free time, he enjoys walking his dog, learning history, and discovering new music online and irl. Connect with him on LinkedIn: https://www.linkedin.com/in/ianhernandez23/

Your Dream Website Is Just One Click Away

At Ericks Webs Design, we believe every business deserves a stunning online presence — without the stress. We offer flexible payment options, a friendly team that truly cares, and expert support every step of the way.

Whether you’re a small business owner, a church, or a growing brand, we’re here to bring your vision to life.

✨ Let’s build something amazing together.

— no pressure, just possibilities.

Latest News & Website Design Tips

Stay up-to-date with the latest insights, trends, and tips in business website design. Explore our newest articles to discover strategies that can help you elevate your online presence and grow your business.

Event Websites That Turn Visitors Into Attendees

Event Websites That Turn Visitors Into Attendees

A well-designed event website is crucial for converting visitors into attendees. Key elements include a user-friendly design, clear calls to action, engaging content, mobile optimization, SEO strategies, and social media integration. By focusing on these aspects, event organizers can enhance visitor engagement and increase ticket sales. Leveraging SEO helps ensure better online visibility, attracting more potential attendees. An effective website can significantly boost event attendance, making it an essential investment for any organizer.

Tools to Help You See Where You Rank on Google

Tools to Help You See Where You Rank on Google

Summary:

For small business owners in South Texas, understanding your Google rankings is crucial for online visibility. Several tools can assist: Google Search Console monitors site presence; SEMrush tracks keywords and analyzes competitors; Moz provides backlink analysis; Ubersuggest offers keyword insights and tracking; and Ahrefs assists with keyword difficulty assessments. By leveraging these tools, you can optimize your content strategically, enhance your online presence, and attract more customers. For expert guidance, Ericks Web Design is here to help you elevate your Google rankings.

Keyword: Google rankings

Restaurant Web Design That Makes Mouths Water

Restaurant Web Design That Makes Mouths Water

Restaurant web design is crucial for attracting customers online. A visually appealing, easy-to-navigate, and mobile-friendly website functions like a menu, showcasing your delicious offerings. High-quality images, captivating content, and effective SEO ensure your restaurant stands out in searches. Regular maintenance keeps information current, engaging visitors and fostering community connections. With the right design, your website can entice potential diners and transform casual visitors into loyal customers. Emphasizing quality and usability in restaurant web design is key to making mouths water and driving business growth.

How Blogging Helps With SEO (Even If Youʼre Not a Writer)

How Blogging Helps With SEO (Even If Youʼre Not a Writer)

Blogging is essential for improving SEO, especially for small business owners in South Texas. By regularly creating content, businesses can incorporate relevant keywords, attract local customers, and keep search engines engaged with fresh material. Even non-writers can benefit by sharing how-to guides, customer testimonials, and local attractions. Consistent blogging enhances online visibility and encourages backlinks, ultimately boosting your site’s credibility. At Ericks Webs Design, we’re ready to help you leverage blogging to enhance your online presence and connect with your audience.

Keyword: SEO

Nonprofit Web Design That Drives Donations

Nonprofit Web Design That Drives Donations

Creating an effective nonprofit website that drives donations requires sharing a compelling story, simplifying navigation, and ensuring mobile responsiveness. Use relatable content that resonates with your audience and include clear calls to action, encouraging different donation methods. Building trust through transparency about impact metrics enhances donor engagement. A well-designed website should not only look good but also motivate visitors to contribute. Focus on emotional connections and authenticity to inspire action and support your mission effectively. Optimize your approach to nonprofit web design to drive those crucial donations.

The Truth About Backlinks and Why You Might Need Them

The Truth About Backlinks and Why You Might Need Them

Summary:

In "The Truth About Backlinks and Why You Might Need Them," the importance of backlinks for small businesses in South Texas is emphasized. Backlinks, or inbound links, enhance your website’s credibility and search engine ranking, driving qualified traffic and building authority. By creating high-quality content, engaging in guest blogging, and networking locally, businesses can effectively acquire these valuable links. Ericks Webs Design, based in McAllen, offers services to strengthen your online presence and help you harness the power of backlinks for growth.

Keyword: Backlinks

Moving Company Website Design That Makes Booking Easy

Moving Company Website Design That Makes Booking Easy

A well-designed moving company website is crucial for converting potential customers into bookings. Focus on user experience by ensuring easy navigation and prominent calls to action, like “Book Your Move Now.” Mobile optimization is essential, as nearly 68% of traffic comes from mobile devices. Simplify contact forms, use a professional aesthetic, and showcase services effectively. Building trust through local identity and regular updates can further enhance engagement and SEO. Make your website inviting and functional to turn browsers into bookers.

How to Name Your Images for Better SEO

How to Name Your Images for Better SEO

Optimizing your images is crucial for improving SEO, especially for small businesses in McAllen. This article emphasizes using clear, descriptive filenames that incorporate relevant keywords, such as "taco-shop-mcallen-delicious-tacos.jpg," to enhance search engine visibility. Utilizing hyphens over underscores and keeping filenames concise can significantly boost indexing. Additionally, including ALT text improves accessibility and elaborates on image content. Organizing images in properly named folders further aids SEO. By following these strategies, businesses can increase traffic and attract more customers.

Keyword: McAllen SEO

Mortgage Lending Websites That Build Trust Quickly

Mortgage Lending Websites That Build Trust Quickly

Creating a trustworthy mortgage lending website is essential for attracting clients. Key elements include a clean, professional design, prominently displayed client testimonials, and valuable educational content. Easy access to contact information and robust security measures, such as SSL certificates, further enhance credibility. An optimized website not only builds trust but can also significantly boost conversion rates, making a strong online presence vital for mortgage businesses. Engage Ericks Web Design to elevate your website and improve client connections effectively. Trust-building in mortgage lending starts with an excellent online experience.