state-management

Guide React and Vue state management with Zustand, Pinia, and TanStack Query.

7|4|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/MadAppGang/magus --skill state-management-madappgang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state-management
Source: https://github.com/MadAppGang/magus/tree/main/plugins/dev/skills/frontend/state-management
Command: npx skills add https://github.com/MadAppGang/magus --skill state-management-madappgang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear patterns and best practices for managing application state in frontend frameworks like React and Vue, ensuring efficient data flow and predictable application behavior.

Core Features & Use Cases

  • State Categorization: Differentiates between local UI, server, global app, and URL state.
  • Framework Solutions: Demonstrates usage with popular libraries like Zustand (React) and Pinia (Vue), and TanStack Query for server state.
  • Best Practices: Covers colocation, single source of truth, deriving state, and normalization.
  • Use Case: When building a complex e-commerce frontend, use this Skill to decide whether to use Zustand for global cart state, TanStack Query for fetching product data, and router params for filtering products by category.

Quick Start

Use the state-management skill to implement global state management with Zustand for a React application.

Frequently Asked Questions about state-management

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best way to manage frontend state in React and Vue applications?

Frontend state management is best handled by categorizing data into local UI, global app, server, and URL state. Apply patterns like state colocation, single source of truth, and deriving state over storing it.

How do I implement global state management with Zustand in a React application?

To implement global state management with Zustand in a React application, use the library to maintain a single source of truth for application-wide data. This approach ensures predictable data flow and efficient state updates across components.

When do I need TanStack Query for server state instead of global state libraries?

You need TanStack Query for server state when fetching remote data like product details, as it separates asynchronous server data from client interactions. Global state libraries like Zustand or Pinia should handle local UI and global app state instead.

Does Pinia work for managing global application state in Vue?

Yes, Pinia works for managing global application state in Vue by providing a centralized store. It enables predictable application behavior and efficient data flow for complex frontend architectures requiring shared state across components.

State management not working efficiently, what are the limitations of storing derived state?

The limitation of storing derived state is redundant data synchronization, which causes inefficient updates. Instead of storing it, derive state directly from the single source of truth to ensure predictable application behavior and avoid data mismatches.