fulcro-routing

Implement Fulcro dynamic routing with defrouter and route targets.

1|Updated Aug 16, 2018
One-click install
npx skills add https://github.com/saskenuba/dotfiles --skill fulcro-routing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fulcro-routing
Source: https://github.com/saskenuba/dotfiles/tree/main/ai/.claude/skills/fulcro-routing
Command: npx skills add https://github.com/saskenuba/dotfiles --skill fulcro-routing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guides developers on implementing Fulcro dynamic routing using defrouter, route targets, and deferred loading to create robust, state-driven UIs.

Core Features & Use Cases

  • Dynamic Router: Implement a single defrouter that switches UI targets based on app state.
  • Route Targets: Create defsc components that act as routing destinations with proper :route-segment and :will-enter logic.
  • Deferred Routing: Use route-deferred for data loading before activating a route to avoid empty states.
  • Initialization & Navigation: Initialize routers in parent components and navigate via dr/change-route!.

Quick Start

Start by defining a router with defrouter, add at least one route target implementing :route-segment and :will-enter, initialize in the parent state, and trigger a route change using dr/change-route!.

Frequently Asked Questions about fulcro-routing

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

FAQPage Schema
How do I implement dynamic routing in a Fulcro single-page application?

Dynamic routing in Fulcro is implemented by defining a defrouter that switches UI targets based on app state. You create defsc components as route targets with proper :route-segment and :will-enter logic to handle route changes.

What is deferred loading in Fulcro routing and when should I use route-deferred?

Deferred loading in Fulcro routing prevents empty UI states by fetching data before activating a route. Use route-deferred within a target's :will-enter hook to load required data, ensuring the UI is fully populated before the route becomes visible.

How do I navigate between route targets after initializing a Fulcro defrouter?

To navigate between route targets after initializing a Fulcro defrouter in parent state, trigger a route change using the dr/change-route! function. This updates the application state and directs the defrouter to render the matching target component.

Can I create a single Fulcro router that switches UI targets based on app state?

Yes, you can create a single dynamic router using defrouter that switches UI targets based on app state. This approach allows you to manage complex UI state transitions by mapping route segments directly to specific defsc components.

How do I configure defsc components to act as Fulcro route targets?

To configure defsc components as Fulcro route targets, implement the :route-segment property to define the URL path and the :will-enter hook to manage routing logic or deferred data loading before the component renders on screen.

Why does my Fulcro route target render an empty state before data loads?

A Fulcro route target renders an empty state when data loads synchronously without waiting for the database. To fix this, use route-deferred in the component's :will-enter hook to load data before the router activates the target route.