react-router

Automate server-first data loading and mutations for React Router v7 SSR applications.

Updated May 9, 2020
One-click install
npx skills add https://github.com/Fenntasy/dotfiles --skill react-router-fenntasy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-router
Source: https://github.com/Fenntasy/dotfiles/tree/main/claude/skills/react-router
Command: npx skills add https://github.com/Fenntasy/dotfiles --skill react-router-fenntasy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Server-first data handling with React Router v7 often leads to complex data fetching, mutation flows, and state management across loaders and actions. This Skill provides a cohesive set of patterns to simplify SSR data flow and UI updates.

Core Features & Use Cases

  • Server-first data loading: Loaders run on the server before render, ensuring data is ready.
  • Mutations via actions: Form-based mutations flow through route actions with automatic revalidation of loaders.
  • Progressive enhancement: Forms work without JavaScript when possible, preserving accessibility.
  • Type-safe data: Use useLoaderData and useActionData with TypeScript inference for safer code.

Quick Start

Start by wiring loaders and actions for a sample route and render UI with useLoaderData.

Frequently Asked Questions about react-router

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

FAQPage Schema
How do I implement server-side data loading in React Router v7?

Server-side data loading in React Router v7 uses loaders that run on the server before render, ensuring data is ready and automatically revalidating after mutations. This pattern simplifies SSR data flow and UI updates.

How do I handle form mutations and automatic revalidation with React Router?

Form mutations in React Router flow through route actions, triggering automatic revalidation of active loaders to refresh server data. This action-based approach maintains progressive enhancement so forms work even without JavaScript.

Can I get type-safe data from useLoaderData and useActionData in TypeScript?

Yes, useLoaderData and useActionData support TypeScript inference for type-safe routing integration. This ensures safer code by automatically typing the server data returned from loaders and the results from action mutations.

What is the best way to manage URL state in server-side rendered React applications?

The best way to manage URL state in SSR React applications is using server-first patterns with React Router v7. Loaders and actions handle data fetching and mutations directly on the server before rendering.

Does React Router v7 support progressive enhancement for accessible forms?

React Router v7 supports progressive enhancement through Form-based mutations that function without JavaScript when possible. This preserves accessibility while allowing route actions to process data on the server.