Skills Plugins MCP Prompt Model 博客 我的中心

react-state-management

Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query. Use when setting up global state, managing server state, or choosing between state management solutions.

DeepseekModel 官方收录技能 质量 优秀 · 90 v1.0.0

获取

https://deepseekmodel.com/api/download.php?id=wshobson-agents-plugins-frontend-mobile-development-skills-react-state-management-skill-md&format=skill
下载 .skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用
.skill 文件中 system_prompt 字段的实际内容。
name react-state-management description Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query. Use when setting up global state, managing server state, or choosing between state management solutions. React State Management Comprehensive guide to modern React state management patterns, from local component state to global stores and server state synchronization. When to Use This Skill Setting up global state management in a React app Choosing between Redux Toolkit, Zustand, or Jotai Managing server state with React Query or SWR Implementing optimistic updates Debugging state-related issues Migrating from legacy Redux to modern patterns Core Concepts 1. State Categories Type Description Solutions Local State Component-specific, UI state useState, useReducer Global State Shared across components Redux Toolkit, Zustand, Jotai Server State Remote data, caching React Query, SWR, RTK Query URL State Route parameters, search React Router, nuqs Form State Input values, validation React Hook Form, Formik 2. Selection Criteria Small app, simple state → Zustand or Jotai Large app, complex state → Redux Toolkit Heavy server interaction → React Query + light client state Atomic/granular updates → Jotai Quick Start Zustand (Simplest) // store/useStore.ts import { create } from 'zustand' import { devtools, persist } from 'zustand/middleware' interface AppState { user : User | null theme : 'light' | 'dark' setUser : ( user : User | null ) => void toggleTheme : () => void } export const useStore = create< AppState >()( devtools ( persist ( ( set ) => ({ user : null , theme : 'light' , setUser : ( user ) => set ({ user }), toggleTheme : () => set ( ( state ) => ({ theme : state. theme === 'light' ? 'dark' : 'light' })), }), { name : 'app-storage' } ) ) ) // Usage in component function Header ( ) { const { user, theme, toggleTheme } = useStore () return ( < header className = {theme} > {user?.name} < button onClick = {toggleTheme} > Toggle Theme </ button > </ header > ) } Detailed patterns and worked examples Detailed pattern documentation lives in references/details.md . Read that file when the navigation tier above is insufficient. Best Practices Do's Colocate state - Keep state as close to where it's used as possible Use selectors - Prevent unnecessary re-renders with selective subscriptions Normalize data - Flatten nested structures for easier updates Type everything - Full TypeScript coverage prevents runtime errors Separate concerns - Server state (React Query) vs client state (Zustand) Don'ts Don't over-globalize - Not everything needs to be in global state Don't duplicate server state - Let React Query manage it Don't mutate directly - Always use immutable updates Don't store derived data - Compute it instead Don't mix paradigms - Pick one primary solution per category Migration Guides From Legacy Redux to RTK // Before (legacy Redux) const ADD_TODO = "ADD_TODO" ; const addTodo = ( text ) => ({ type : ADD_TODO , payload : text }); function todosReducer ( state = [], action ) { switch (action. type ) { case ADD_TODO : return [...state, { text : action. payload , completed : false }]; default : return state; } } // After (Redux Toolkit) const todosSlice = createSlice ({ name : "todos" , initialState : [], reducers : { addTodo : ( state, action : PayloadAction < string > ) => { // Immer allows "mutations" state. push ({ text : action. payload , completed : false }); }, }, });
Agent 识别该技能的关键词,点击任意一个即可复制。

该技能未提供触发词。

下载的 .skill 包内含以下字段。
字段 说明
format格式标识(skill/v1)
skill_id技能唯一 ID
name技能名称
version版本号
description技能描述
category所属分类(数组)
trigger_words触发词列表
tags标签列表
source来源标识
source_url来源链接(本页地址)
exported_at导出时间(每次下载生成)
system_prompt系统提示词正文
model_config模型参数:provider / model / temperature / max_tokens / top_p
examples示例
install_guide各平台导入说明(Coze / Dify / Claude / 自定义框架)
同一份技能可按不同平台格式导出。
.skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用 下载
.skillpro 增强格式,额外含脚本 / 工具 / 依赖 / 钩子占位 下载
.json 纯 JSON 导出,只含 system_prompt 与模型参数 下载
Coze 带 frontmatter 的 Markdown,Coze 平台导入用 下载
Dify Dify DSL,创建应用后直接导入 下载

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。