Shopify

React Server Components Best Practices You Can Use with Hydrogen - Shopify

Feb 4, 2022
React Server Components Best Practices You Can Use with Hydrogen - Shopify
SummaryAI, from the source post

This post details best practices for using React Server Components (RSC) within Hydrogen applications. It advocates for starting with shared components, pivoting to client components only in rare cases for specific interactivity needs (useState, useEffect, browser APIs, unsupported third-party libraries), and pivoting to server components whenever possible, especially for proprietary logic, filesystem/database access, or data fetching. It provides examples for Newsletter Sign-up and Product FAQs, demonstrating how to extract client functionality into separate .client.jsx files and rename components to .server.jsx when appropriate.

More from the Hosting for Custom Storefronts (Oxygen) trail