npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tao.js/routing-react-router

v0.21.0

Published

React Router adapter: loaders as TAO AppCon entry points

Downloads

736

Readme

@tao.js/routing-react-router

React Router adapter for the @tao.js/routing-core contract: data-router loaders as TAO feature entry points.

Read routing-core first for philosophy (feature modules, code splitting, nested skipInit / skipLoad), signal shapes, and createImportLoader options. This README only shows how to apply that contract with React Router.

What this adapter does

| Step | React Router API | This package | | ---- | --------------------------------------- | ------------------------------------- | | 1 | Route loader runs on navigation | importLoader(TAO) inside the loader | | 2 | Loader data is { signal } (or null) | same bag as core | | 3 | Route element mounts | useLoaderSignal() → Kernel | | 4 | UI | @tao.js/react RenderHandler etc. |

useLoaderSignal is createUseSignalEffect wired to react-router’s useLoaderData + @tao.js/react’s useTaoContext.

Install

pnpm add @tao.js/routing-react-router @tao.js/routing-core @tao.js/core @tao.js/react react react-router react-dom
# often also:
pnpm add react-router-dom

| Peer | Constraint | | ---------------------- | ---------------------------------- | | @tao.js/routing-core | * | | @tao.js/core | * | | @tao.js/react | * | | react | >=16.8.0 | | react-router | >=6.4.0 (data routers / loaders) |

Use createBrowserRouter / RouterProvider (or another data router).

Implement the philosophy with React Router

1. Feature modules

Author tao/*.js as in routing-core — Feature module contract. No React Router types required.

2. Shared Kernel + TaoProvider

// src/tao.js
import { Kernel } from '@tao.js/core';
export const TAO = new Kernel();
// src/main.jsx
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { TaoProvider } from '@tao.js/react';
import { RouterProvider } from 'react-router';
import { TAO } from './tao';
import { router } from './router';

createRoot(document.getElementById('root')).render(
  <StrictMode>
    <TaoProvider TAO={TAO}>
      <RouterProvider router={router} />
    </TaoProvider>
  </StrictMode>,
);

Pass this same TAO into every importLoader(TAO, …).

3. Put importLoader on route loaders

Code-split boundary = import('./tao/…') inside the loader (React Router already defers loader work until the route matches / prefetches).

// src/router.js
import { createBrowserRouter } from 'react-router';
import { importLoader } from '@tao.js/routing-react-router';
import { TAO } from './tao';
import { Layout } from './pages/Layout';
import { HomePage } from './pages/HomePage';
import { ProductListPage } from './pages/ProductListPage';
import { ProductDetailsPage } from './pages/ProductDetailsPage';

const homeLoader = importLoader(TAO);

// Parent: initialize Product feature once; no enter signal.
const productBaseLoader = importLoader(TAO, { skipLoad: true });

// Children: skipInit; choose load helper (+ params).
const productListLoader = importLoader(TAO, {
  skipInit: true,
  loadSignal: ({ fetchProducts }) => fetchProducts(),
});
const productDetailsLoader = importLoader(TAO, {
  skipInit: true,
  loadSignal: ({ locateProduct }, params) => locateProduct(params),
});

export const router = createBrowserRouter([
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        index: true,
        element: <HomePage />,
        loader: (...args) => homeLoader(import('./tao/home'), ...args),
      },
      {
        path: 'products',
        loader: () => productBaseLoader(import('./tao/product')),
        children: [
          {
            index: true,
            element: <ProductListPage />,
            loader: () => productListLoader(import('./tao/product')),
          },
          {
            path: ':id',
            element: <ProductDetailsPage />,
            loader: ({ params }) =>
              productDetailsLoader(import('./tao/product'), params),
          },
        ],
      },
    ],
  },
]);

Options (skipInit, skipLoad, loadSignal): routing-core.

4. Enter TAO in the route element

// src/pages/ProductDetailsPage.jsx
import { RenderHandler } from '@tao.js/react';
import { useLoaderSignal } from '@tao.js/routing-react-router';

export function ProductDetailsPage() {
  useLoaderSignal(); // reads useLoaderData().signal → applySignal(TAO, signal)

  return (
    <RenderHandler t="Product" a="View" o="Portal">
      {(tao, data) => <h1>Product {data.Product?.id}</h1>}
    </RenderHandler>
  );
}
navigate → RR loader → importLoader → { signal }
  → element render → useLoaderSignal → Kernel → RenderHandler

SSR with React Router frameworks (Remix, RR7 SSR): same loader → { signal } idea; prefer serializable signal shapes if the payload crosses a server/client boundary (routing-core).

Exports

import {
  importLoader,
  useLoaderSignal,
  applySignal,
  getSignal,
  createImportLoader,
} from '@tao.js/routing-react-router';