Advancednote 03 of 1203 reasons · 03 notes
ReactAdvanced
Split client islands carefully
Move the smallest interactive piece into a client component and keep the shell server-rendered.
Code example
Copy, adapt, and ship.
Read the numbered lines, copy the complete snippet, then adjust the values for your project.
// Server componentexport default async function ArticlePage() { const article = await getArticle(); return ( <article> <ArticleBody article={article} /> <ShareButton title={article.title} /> </article> );}Why this matters
The production reason.
- 01
A full page often becomes client-side because one dropdown or copy button needs JavaScript.
- 02
Split that interactive part into a small island and leave the surrounding content as static server-rendered markup.
- 03
You keep the UX interactive without paying a bundle cost for the whole page.
How it holds up outside a demo.
- Next.jsPut 'use client' in ShareButton.jsx, not ArticlePage.jsx.
- AstroThis is the same idea as hydrating only the component that needs interaction.
- Marketing pagesKeep hero copy and sections static; hydrate calculators or forms only.
Explore other stacks
Jump into a different technology.
12 React notes on this shelf, and six more stacks beside it.
Use next/image for image optimization
Next.js image optimization starts with next/image sizing, lazy loading, modern formats, and predictable dimensions.
Open the noteAbort stale fetch requests
Cancel outdated browser requests so fast UI changes do not render old data.
Open the noteBuild a CSS gradient generator with code export
A CSS gradient generator should preview color stops, preserve accessible contrast, and export clean CSS code.
Open the noteFix WordPress H1 SEO issues
Fix WordPress SEO issues by keeping one clear H1, escaping template output, and compressing images before WordPress upload.
Open the noteReduce LCP with image optimization
Reduce LCP with image optimization by resizing, converting, and compressing images before they reach production.
Open the noteUse real buttons for actions
If it changes state, use button. If it navigates, use a link.
Open the note