Frontend State Management

Frontend State Management

Teaches an agent to manage frontend application state with Redux Toolkit, MobX, Zustand and the Context API, with examples and a component template.

Skill files6 files

references/

templates/

SKILL.md88 lines
1
---
2
name: frontend-state-management
3
description: >
4
Manage application state using Redux, MobX, Zustand, and Context API. Use when
5
centralizing state for complex applications with multiple components.
6
---
7
8
# Frontend State Management
9
10
## Table of Contents
11
12
- [Overview](#overview)
13
- [When to Use](#when-to-use)
14
- [Quick Start](#quick-start)
15
- [Reference Guides](#reference-guides)
16
- [Best Practices](#best-practices)
17
18
## Overview
19
20
Implement scalable state management solutions using modern patterns and libraries to handle application state, side effects, and data flow across components.
21
22
## When to Use
23
24
- Complex application state
25
- Multiple components sharing state
26
- Predictable state mutations
27
- Time-travel debugging needs
28
- Server state synchronization
29
30
## Quick Start
31
32
Minimal working example:
33
34
```typescript
35
// store/userSlice.ts
36
import { createSlice, createAsyncThunk, PayloadAction } from '@reduxjs/toolkit';
37
38
interface User {
39
id: number;
40
name: string;
41
email: string;
42
}
43
44
interface UserState {
45
items: User[];
46
loading: boolean;
47
error: string | null;
48
}
49
50
const initialState: UserState = {
51
items: [],
52
loading: false,
53
error: null
54
};
55
56
export const fetchUsers = createAsyncThunk(
57
'users/fetchUsers',
58
async (_, { rejectWithValue }) => {
59
try {
60
// ... (see reference guides for full implementation)
61
```
62
63
## Reference Guides
64
65
Detailed implementations in the `references/` directory:
66
67
| Guide | Contents |
68
|---|---|
69
| [Redux with Redux Toolkit (React)](references/redux-with-redux-toolkit-react.md) | Redux with Redux Toolkit (React) |
70
| [Zustand (Lightweight State Management)](references/zustand-lightweight-state-management.md) | Zustand (Lightweight State Management) |
71
| [Context API + useReducer](references/context-api-usereducer.md) | Context API + useReducer |
72
| [MobX (Observable State)](references/mobx-observable-state.md) | MobX (Observable State) |
73
74
## Best Practices
75
76
### ✅ DO
77
78
- Follow established patterns and conventions
79
- Write clean, maintainable code
80
- Add appropriate documentation
81
- Test thoroughly before deploying
82
83
### ❌ DON'T
84
85
- Skip testing or validation
86
- Ignore error handling
87
- Hard-code configuration values
88

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…