context-pattern
CommunityType-safe React Context patterns for modern apps.
Software Engineering#typescript#react#state-management#selector#context-pattern#useSyncExternalStore#hook-pattern
Authortrae-op
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This skill provides a reusable, type-safe React Context pattern using useSyncExternalStore to minimize re-renders and simplify consumption via selectors and dispatchers.
Core Features & Use Cases
- Type-safe Context pattern with separate files for Context.tsx, types.ts, useContext.ts, and useSelectors.ts
- useSyncExternalStore-based selectors to subscribe to specific state slices without unnecessary re-renders
- Lightweight, scalable shared state management suitable for large React apps and codebase refactors
Quick Start
Create a new feature context by following the prescribed file structure under context/ and implement the four files: Context.tsx, types.ts, useContext.ts, and useSelectors.ts. Then wrap components with the Provider and use the provided hooks and selectors to access and modify state.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: context-pattern Download link: https://github.com/trae-op/electron-password-generation/archive/main.zip#context-pattern Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.