---
title: "React Server Components Best Practices You Can Use with Hydrogen"
description: "When building React Server Components applications, start every new component as a shared component, extract only the genuinely client-side pieces (interactivity, useState/useReducer, useEffect, browser APIs, RSC-incompatible libraries) into small .client components, and convert the rest to .server components whenever the code never needs to or should not run on the client."
url: "https://swe.quest/articles/react-server-components-best-practices-you-can-use-with-hydrogen-0db12dbc50e3b28e"
canonical: "https://shopify.engineering/react-server-components-best-practices-hydrogen"
source: "Shopify Engineering"
published: "2022-02-04"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["react","frontend","web-performance","ecommerce"]
---

# React Server Components Best Practices You Can Use with Hydrogen

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2022-02-04, 7 min read, How-to. Original: [https://shopify.engineering/react-server-components-best-practices-hydrogen](https://shopify.engineering/react-server-components-best-practices-hydrogen)

## Summary

When building React Server Components applications, start every new component as a shared component, extract only the genuinely client-side pieces (interactivity, useState/useReducer, useEffect, browser APIs, RSC-incompatible libraries) into small .client components, and convert the rest to .server components whenever the code never needs to or should not run on the client. Server components can still be rendered inside client components by passing them as children rather than importing them, which avoids inflating the client bundle. Two Hydrogen starter examples, a footer newsletter sign-up and a product FAQ accordion, show the refactoring steps, with the bundle shrinking because only the form and accordion logic ship to the browser.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Web performance](https://swe.quest/tags/web-performance.md) (Web & mobile)
- [E-commerce](https://swe.quest/tags/ecommerce.md) (Domains)

## Prerequisites

- React components and hooks ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- Server-side rendering basics

## Keywords

React Server Components, Hydrogen, Shopify, Stackblitz

## Related posts

- [How We Built Hydrogen: A React Framework for Building Custom Storefronts](https://swe.quest/articles/how-we-built-hydrogen-a-react-framework-for-building-custom-storefronts-0de0baea8226959f.md): Shopify Engineering · 2022-06-22 · Medium · 13 min read · React, Frontend, Web performance, GraphQL, E-commerce
  Hydrogen, Shopify's React framework for custom storefronts, was built on React Server Components, React 18 streaming SSR and Vite, chosen over static JAMStack approaches because commerce pages are inherently dynamic.
- [Building Blocks of High Performance Hydrogen-powered Storefronts](https://swe.quest/articles/building-blocks-of-high-performance-hydrogen-powered-storefronts-c8500e9da77cf962.md): Shopify Engineering · 2021-11-08 · Easy · 7 min read · React, Web performance, Frontend, E-commerce, Caching
  Hydrogen, Shopify's React-based storefront framework, targets the tension between fast loading and personalized, dynamic commerce by combining React 18 streaming SSR with Suspense, React Server Components, cache-aware data fetching, and per-page edge caching.
- [A Gentle Introduction to Islands](https://swe.quest/articles/a-gentle-introduction-to-islands-51c545953d15b8b9.md): Deno · 2023-04-26 · Medium · 10 min read · Frontend, Web performance, JavaScript, TypeScript
  Islands architecture renders pages as static HTML and hydrates only isolated interactive Preact components, avoiding the whole-page, top-down hydration that ships framework JS even for static content.
- [Rapid Development with Hydrogen: Building a Product Page](https://swe.quest/articles/rapid-development-with-hydrogen-building-a-product-page-02ffb62bb6c7bb95.md): Shopify Engineering · 2022-02-02 · Medium · 5 min read · React, E-commerce, Frontend
  Hydrogen, Shopify's React-based storefront framework, can produce a working product display page quickly by composing its built-in commerce components and hooks.
- [Best-in-Class Developer Experience with Vite and Hydrogen](https://swe.quest/articles/best-in-class-developer-experience-with-vite-and-hydrogen-71158a029a23fe79.md): Shopify Engineering · 2022-03-31 · Easy · 8 min read · Build systems, Frontend, React, JavaScript, Developer productivity
  Shopify's Hydrogen storefront framework is built on Vite. Vite serves user code as native ES Modules and pre-bundles and caches only third-party dependencies, which speeds up dev-server startup and hot module replacement compared with bundle-based tools like Webpack.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
