bulletproof-react-components

Build bulletproof React components that survive SSR, hydration, concurrent rendering, portals, transitions, and future React changes. Nine essential patterns from Shu Ding's guide. Use when writing reusable React components, fixing hydration mismatches, handling SSR edge cases, or building component libraries.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "bulletproof-react-components" with this command: npx skills add codewithshreyans/skills/codewithshreyans-skills-bulletproof-react-components

Bulletproof React Components

Nine patterns that ensure React components survive real-world conditions beyond the happy path — SSR, hydration, concurrent rendering, portals, and more.

Source: shud.in/thoughts/build-bulletproof-react-components

How It Works

  1. When writing or reviewing a reusable React component, consult the Quick Rules below
  2. For code examples and deeper explanation, read ./references/patterns.md
  3. Run through the Checklist before shipping

Quick Rules

#PatternRule
1Server-ProofNever call browser APIs (localStorage, window, document) during render. Use useEffect.
2Hydration-ProofInject a synchronous inline <script> to set client-dependent values before React hydration.
3Instance-ProofUse useId() for all generated IDs. Never hardcode IDs in reusable components.
4Concurrent-ProofWrap server data-fetching in React.cache() to deduplicate calls per request.
5Composition-ProofUse Context instead of React.cloneElement() — cloneElement breaks with Server Components, lazy, and memo.
6Portal-ProofUse ref.current?.ownerDocument.defaultView || window for event listeners, not the global window.
7Transition-ProofWrap state updates in startTransition() to enable View Transition API animations.
8Activity-ProofUse useLayoutEffect to disable DOM side effects (e.g., <style> tags) when hidden by <Activity>.
9Future-ProofUse useState(() => value) for stable identity. useMemo is only a performance hint — React may discard it.

Checklist

When building a reusable React component, verify:

  • No browser APIs called during render (server-proof)
  • No hydration flash for client-storage values (hydration-proof)
  • No hardcoded IDs; uses useId() (instance-proof)
  • Server data fetches wrapped in cache() (concurrent-proof)
  • Uses Context instead of cloneElement (composition-proof)
  • Event listeners use ownerDocument.defaultView (portal-proof)
  • State updates wrapped in startTransition() where needed (transition-proof)
  • DOM side effects respect <Activity> visibility (activity-proof)
  • Stable values use useState initializer, not useMemo (future-proof)

Present Results to User

When reviewing a component against these patterns, format as:

**Bulletproof Check: `<ComponentName>`**

| Pattern | Status | Notes |
|---------|--------|-------|
| Server-Proof | PASS/FAIL | ... |
| ... | ... | ... |

**Suggested fixes:**
1. ...

References

  • ./references/patterns.md — Detailed code examples (bad/good) for all nine patterns

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Self Updater

⭐ OPEN SOURCE! GitHub: github.com/GhostDragon124/openclaw-self-updater ⭐ ONLY skill with Cron-aware + Idle detection! Auto-updates OpenClaw core & skills, an...

Registry SourceRecently Updated
1171Profile unavailable
Coding

ClawHub CLI Assistant

Use the ClawHub CLI to publish, inspect, version, update, sync, and troubleshoot OpenClaw skills from the terminal.

Registry SourceRecently Updated
1.9K2Profile unavailable
Coding

SkillTree Learning Progress Tracker

Track learning across topics like an RPG skill tree. Prerequisites, milestones, suggested next steps. Gamified learning path.

Registry SourceRecently Updated
900Profile unavailable
Coding

Speak Turbo - Talk to your Claude 90ms latency!

Give your agent the ability to speak to you real-time. Talk to your Claude! Ultra-fast TTS, text-to-speech, voice synthesis, audio output with ~90ms latency....

Registry SourceRecently Updated
4480Profile unavailable