store-data-structures

Structure Zustand store data for lists, details, caching, and optimistic updates.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/alceupassos/hub --skill store-data-structures-alceupassos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: store-data-structures
Source: https://github.com/alceupassos/hub/tree/main/.agents/skills/store-data-structures
Command: npx skills add https://github.com/alceupassos/hub --skill store-data-structures-alceupassos

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides guidance on structuring data within Zustand stores for optimal performance, including handling list and detail pages, caching, and optimistic updates.

Core Features & Use Cases

  • Separate List and Detail: Offers best practices for designing separate data structures for list and detail pages.
  • Map vs Array Usage: Explains when to use a Map for detail data caching and a simple array for list data.
  • State Structure Pattern: Describes a pattern for structuring state for benchmarks, including lists, details, and loading states.
  • Reducer Pattern: Details how to implement a reducer for detail map optimistic updates.
  • Component Usage: Provides examples of how to access list and detail data in components.
  • Decision Tree: A visual guide to choosing between using a Map or Array for data storage.
  • Checklist: A comprehensive checklist for designing store state structure.
  • Best Practices: Recommendations for organizing files, naming conventions, and avoiding common mistakes.

Quick Start

Implement the store data structures for a benchmark slice in your Zustand store.

Frequently Asked Questions about store-data-structures

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

FAQPage Schema
What is the best way to structure Zustand store data for list and detail pages?

The best way to structure Zustand store data is by separating list and detail pages, using a simple array for list data and a Map for detail data caching to optimize React UI rendering and state management.

How do I implement optimistic updates in a Zustand store using TypeScript?

You implement optimistic updates in a Zustand store by applying a reducer pattern specifically designed for detail map updates, ensuring efficient state management and immediate UI rendering feedback in React.

When should I use a Map versus an Array for state management in React?

Use a Map for detail data caching to allow quick lookups by ID, and use a simple Array for list data to maintain rendering order, guided by a specific decision tree for structuring Zustand state.

Do I need prior knowledge of Zustand to optimize my React state structure?

Yes, optimizing your state structure requires existing knowledge of Zustand and React state management principles to effectively implement caching, loading states, and UI rendering patterns.

How do I avoid common mistakes when organizing state in Zustand?

Avoid common mistakes when organizing state in Zustand by following a comprehensive checklist and best practices for file organization, naming conventions, and structuring lists, details, and loading states.

Why does my React UI re-render excessively when updating Zustand list data?

Excessive React UI re-rendering during Zustand list data updates often occurs when detail and list data structures are not properly separated, a problem solved by using distinct arrays and Maps for caching.