react-router-remix-setup

Integrate useUrlState with React Router v6/v7 and Remix v2 imports.

418|10|Updated Feb 28, 2024
One-click install
npx skills add https://github.com/asmyshlyaev177/state-in-url --skill react-router-remix-setup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-router-remix-setup
Source: https://github.com/asmyshlyaev177/state-in-url/tree/main/skills/react-router-remix-setup
Command: npx skills add https://github.com/asmyshlyaev177/state-in-url --skill react-router-remix-setup

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires feature-state-hook.

What problem does it solve?

Ensures developers correctly integrate state-in-url’s useUrlState hook into React Router or Remix while matching the correct import path and navigation option behavior for each router version.

Core Features & Use Cases

  • Shared hook behavior across platforms: Keeps the hook signature, return shape, and core semantics consistent for React Router v6, v7, and Remix v2.
  • Correct per-call navigation options: Supports NavigateOptions-style controls like preventScrollReset, state, and replace to preserve UX expectations during URL-driven UI updates.
  • Avoids common migration and import pitfalls: Prevents breaking changes caused by using the wrong subpath for React Router v6 versus v7.
  • SSR and hydration considerations: Clarifies Remix v2 hydration behavior versus React Router CSR-only defaults.

Quick Start

Load the react-router-remix-setup skill and import useUrlState from state-in-url/react-router for v7, state-in-url/react-router6 for v6, or state-in-url/remix for Remix v2 while passing your desired NavigateOptions per setUrl call.

Frequently Asked Questions about react-router-remix-setup

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

FAQPage Schema
How do I sync useUrlState with React Router v6 or v7?

Import useUrlState from state-in-url/react-router6 for v6 or state-in-url/react-router for v7 to wire URL state management correctly, avoiding breaking changes caused by using the wrong subpath.

Does useUrlState work with Remix v2 and handle SSR hydration?

Yes, useUrlState works with Remix v2 by importing from state-in-url/remix, clarifying Remix v2 hydration behavior and SSR expectations versus React Router CSR-only defaults for consistent URL state.

Can I pass navigation options like preventScrollReset when updating URL state?

Yes, you can pass per-call NavigateOptions like preventScrollReset, state, and replace to your setUrl calls to preserve UX expectations during URL-driven UI updates.

What is the correct default-state pattern for useUrlState in React Router?

The correct default-state pattern for useUrlState is a module-scoped pattern enforced by the feature-state-hook dependency, ensuring consistent state-in-url behavior across React Router and Remix.

Why does my useUrlState hook break after migrating to React Router v7?

Your useUrlState hook breaks after migrating to React Router v7 because the import path changed; you must update imports from state-in-url/react-router6 to state-in-url/react-router to match v7 behavior.