Fähigkeiten react-state-management
📦

react-state-management

Sicher ⚙️ Externe Befehle🌐 Netzwerkzugriff

Implement React State Management

Auch verfügbar von: wshobson

This skill helps developers choose and implement the right state management solution for React applications, from simple local state to complex global stores with server synchronization.

Unterstützt: Claude Codex Code(CC)
🥉 74 Bronze
1

Die Skill-ZIP herunterladen

2

In Claude hochladen

Gehe zu Einstellungen → Fähigkeiten → Skills → Skill hochladen

3

Einschalten und loslegen

Teste es

Verwendung von "react-state-management". How do I choose between Redux Toolkit and Zustand?

Erwartetes Ergebnis:

For small to medium apps with simple state needs, Zustand offers a minimal API with excellent TypeScript support. For large enterprise apps requiring middleware, devtools integration, and strict patterns, Redux Toolkit provides structure. Use Zustand when: you need simple global state without boilerplate, you prefer hooks-based API, you want minimal bundle size. Use Redux Toolkit when: you need complex async logic with thunks, you require strict action tracking for debugging, your team is familiar with Redux patterns.

Verwendung von "react-state-management". Set up React Query for data fetching

Erwartetes Ergebnis:

Install @tanstack/react-query, then wrap your app with QueryClientProvider. Create a query client with default options for caching. Use useQuery hook for fetching with keys for cache management. Use useMutation for updates with optimistic updates via onMutate. The query key ['users', userId] enables automatic refetching and caching.

Sicherheitsaudit

Sicher
v1 • 2/24/2026

This is a documentation skill for React state management patterns. Static analysis flagged external_commands, network, and sensitive data patterns, but evaluation confirms these are FALSE POSITIVES - the 'backticks' are TypeScript template literals in code examples, 'fetch' calls are legitimate API examples, and 'localStorage' access is proper state persistence teaching. No actual security risks identified.

1
Gescannte Dateien
444
Analysierte Zeilen
5
befunde
1
Gesamtzahl Audits
Probleme mit mittlerem Risiko (2)
External Command Pattern Detected (FALSE POSITIVE)
Static analyzer flagged backtick usage as shell command execution. This is a false positive - backticks are TypeScript template literals in code examples for educational content about React state management.
Network API Calls in Code Examples (FALSE POSITIVE)
Static analyzer flagged fetch() calls and URLs. These are legitimate code examples teaching proper API integration patterns.
Probleme mit niedrigem Risiko (1)
Browser Storage Access (FALSE POSITIVE)
localStorage usage flagged as sensitive data access. This is proper state persistence teaching in React patterns.
Auditiert von: claude

Qualitätsbewertung

38
Architektur
100
Wartbarkeit
87
Inhalt
50
Community
93
Sicherheit
100
Spezifikationskonformität

Was du bauen kannst

New React Project Setup

Choose and configure the appropriate state management solution when starting a new React application

Legacy Migration

Migrate from older Redux patterns or class components to modern state management approaches

Performance Optimization

Reduce unnecessary re-renders and optimize state access patterns in existing applications

Probiere diese Prompts

Basic State Setup
Show me how to set up Zustand for a simple React app with user authentication state and theme toggle.
Redux Toolkit Setup
Create a Redux Toolkit store with typed hooks and a user slice that handles async fetching.
Server State with React Query
Set up React Query for fetching user data with caching, optimistic updates on mutations, and error handling.
Atomic State Pattern
Implement Jotai atoms for a shopping cart with derived atoms for totals and persistence to localStorage.

Bewährte Verfahren

  • Separate client state from server state - use React Query for server data and Zustand/Redux for UI state
  • Colocate state close to where it is used - avoid putting everything in global state
  • Use TypeScript for all state-related code to prevent runtime errors and enable better IDE support

Vermeiden

  • Storing server data in global state instead of using React Query - creates synchronization issues
  • Over-globalizing state - putting component-specific state in Redux/Zustand when useState suffices
  • Mutating state directly instead of using immutable update patterns - breaks reactivity

Häufig gestellte Fragen

What is the best state management for a new React project?
For most new projects, Zustand offers the best balance of simplicity and power. Use React Query for server state. Only reach for Redux Toolkit when you have complex async workflows or need middleware.
When should I use React Query vs Redux?
Use React Query for server state (API data, caching, synchronization). Use Redux or Zustand for client state (UI state, user sessions, form data). Never duplicate server state in global stores.
Can I use multiple state solutions together?
Yes - this is recommended. Use React Query for server state, Zustand or Redux for client state, and useState for local component state. Each serves a different purpose.
How do I persist state across page reloads?
Use Zustand persist middleware, Jotai atomWithStorage, or Redux persist. For sensitive data, consider sessionStorage instead of localStorage.
What is the difference between Jotai and Zustand?
Jotai uses atomic state where each atom is independent and derived atoms recompute automatically. Zustand uses a single store with selectors. Jotai excels at granular updates, Zustand at simplicity.
How do I handle async actions in Redux Toolkit?
Use createAsyncThunk for async operations. It handles pending/fulfilled/rejected states automatically and integrates with Redux DevTools for debugging.

Entwicklerdetails

Dateistruktur

📄 SKILL.md