dev-style-state

Organize React app state into URL, server, scoped, and client categories.

Updated Jun 17, 2025
One-click install
npx skills add https://github.com/nikbrunner/dots --skill dev-style-state
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dev-style-state
Source: https://github.com/nikbrunner/dots/tree/main/common/.agents/skills/dev-style-state
Command: npx skills add https://github.com/nikbrunner/dots --skill dev-style-state

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

State confusion across complex frontend apps leads to tangled UI logic and duplicated data handling. This guide helps teams categorize and separate app state by source of truth to simplify architecture, improve maintainability, and reduce coupling between UI and data layers.

Core Features & Use Cases

  • URL State: Drive navigation and filters through router search params, enabling shareable, bookmarkable views without persisting sensitive data.
  • Server State: Clearly separate server-fetched data from UI state, with caching and data-fetch patterns to reduce redundant requests.
  • Scoped/Context State: Use React context or subtree providers to isolate local UI state that resets when leaving a section.
  • Client/Local State: Manage transient UI preferences and flags close to components that consume them for fast feedback.
  • Real-world scenario: structure a complex dashboard so that URL-driven filters live in the URL, lists are sourced from the server, and modal state remains local.

Quick Start

Describe how to structure an application's state into URL, server, scoped, and client categories and implement a minimal example that demonstrates separation across these layers.

Frequently Asked Questions about dev-style-state

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

FAQPage Schema
How do I separate server state and client state in React to avoid tangled UI logic?

Separating server state and client state in React involves categorizing data by its source of truth. Keep server-fetched data distinct from transient UI preferences, using caching and data-fetch patterns to reduce redundant requests and simplify frontend architecture.

What is the best way to manage URL state for filters in a React dashboard?

Managing URL state for filters in a React dashboard is best done by driving navigation through router search params. This creates shareable, bookmarkable views without persisting sensitive data, keeping the source of truth cleanly in the URL.

When should I use React context for scoped state instead of local state?

Use React context for scoped state instead of local state when you need to isolate local UI state within a specific subtree. This ensures the state automatically resets when a user navigates away from that section of the application.

How do I structure a complex React application's state across routing, data fetching, and UI layers?

Structure a complex React application's state by separating it into URL, server, scoped, and client categories. This organization isolates routing, data fetching, and UI layers, reducing coupling and guiding clear cross-reference patterns for implementation.

Does organizing state by source of truth work for complex frontend architectures?

Organizing state by source of truth works effectively for complex frontend architectures. It defines clear separation principles between URL, server, scoped, and client state, which simplifies maintainability and reduces duplicated data handling.

Why does my React app have duplicated data handling and tangled UI logic?

Your React app likely has duplicated data handling and tangled UI logic due to state confusion. Without categorizing state by its source of truth, UI and data layers become coupled, leading to redundant requests and tangled component logic.