Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pieroenrico/tune-me-in/llms.txt
Use this file to discover all available pages before exploring further.
Components
Tune Me In uses Shopify Hydrogen’s component architecture, which distinguishes between server and client components for optimal performance.Server vs Client Components
Hydrogen uses file naming conventions to determine where components run:.server.jsx- Components that run only on the server (can fetch data, access secrets).client.jsx- Components that run on the client (can use React hooks, state, interactivity)
Server Components
Server components render on the server and have access to server-side data. They cannot use client-side features likeuseState or useEffect.
src/components/Layout.server.jsx
Client Components
Client components run in the browser and can use React hooks and handle interactivity.src/components/Button.client.jsx
Component Structure
Tune Me In organizes components into several directories:Creating a New Component
Choose the component type
Determine if your component needs client-side interactivity or can be server-rendered.Use
.client.jsx if you need:- React hooks (
useState,useEffect, etc.) - Browser APIs
- Event handlers
.server.jsx if:- No interactivity needed
- Fetching data from Sanity or Shopify
- Better performance is desired
Create the component file
Create a new file in
src/components/ with the appropriate extension:src/components/ProductBadge.client.jsx
Using Hydrogen Components
Hydrogen provides built-in components for common e-commerce patterns:Product Components
Add to Cart
src/components/ButtonSelectedVariantAddToCart.client.jsx
Component Best Practices
Minimize client components
Minimize client components
Use server components by default for better performance. Only use client components when you need interactivity or browser APIs.
Keep components focused
Keep components focused
Each component should have a single responsibility. Break down complex components into smaller, reusable pieces.
Use TypeScript for type safety
Use TypeScript for type safety
While this starter uses JSX, consider migrating to TSX for better type safety:
Co-locate related components
Co-locate related components
Next Steps
Pages
Learn how to create and structure pages in Hydrogen
Styling
Style your components with Tailwind CSS