feature-state-hook

Community

Share URL-synced React UI state

Authorasmyshlyaev177
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Keep multiple, related React components in sync using shared UI state that also survives reloads and can be shared via the URL, without adding Context providers or manually wiring props everywhere.

Core Features & Use Cases

  • Module-scoped shared defaults: Define a static default-state const once and pass the same object identity into useUrlState so components automatically share URL-synced state.
  • Typed URL state patterns: Model feature state as JSON-serializable TypeScript types for drawer/modals, tab switching, multi-select toggles, paginators, filters, and selections.
  • Clean reset/defaults semantics: Use defaults that represent “no selection” so reset removes query params, keeping URLs short and shareable.

Use case example: Store a job search UI with a selected tab and jobId in the URL so navigating between components (tabs, details panel, modal) stays consistent and deep-links correctly.

Quick Start

Define a single exported typed default object for your feature outside components, then call useUrlState(yourDefaultConst, { searchParams }) inside a custom hook that your UI components import and use.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: feature-state-hook
Download link: https://github.com/asmyshlyaev177/state-in-url/archive/main.zip#feature-state-hook

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.