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

react-view-router

v2.3.1

Published

react-view-router

Readme

ReactViewRouter

English | 简体中文

ReactViewRouter is a configuration-driven React routing gateway that runs in the browser. It centralizes matching, guards, redirects, nested routing, and optional standalone SSR route-island hydration.

Existing SPA usage remains unchanged. Standalone SSR and React Native support are isolated from the default browser bundle.

Installation

npm install react-view-router

The core peer baseline is React 16.8 or newer.

Quick start

// router/routes.tsx
import { lazyImport } from 'react-view-router';
import HomePage from '../pages/HomePage';

export const routes = [
  { path: '/', component: HomePage },
  {
    path: '/orders',
    component: lazyImport(() => import('../pages/OrdersPage')),
  },
];
// App.tsx
import ReactViewRouter, { RouterView } from 'react-view-router';
import { routes } from './router/routes';

const router = new ReactViewRouter({ mode: 'browser', routes });

export default function App() {
  return <RouterView router={router} />;
}

lazyImport accepts a string, a component factory, or a factory returning a Promise. The actual component is the factory result or the resolved Promise value.

Declaring an SSR route

SSR capability is declared per route. ReactViewRouter does not need a global hydration option:

const routes = [{
  path: '/profile',
  component: lazyImport(() => import('./ProfilePage'), {
    hydrate: true,
  }),
}];

hydrate means that the RouteLazy may reuse server-rendered output. The selected standalone adapter decides whether to use React 18 hydrateRoot or React 16/17 hydrate. Without a compatible adapter, the default behavior degrades to a normal client render. Only hydrate: { required: true } makes the missing hydration capability an error.

Multiple SSR pages still share this single routes tree. On the server, resolveHydratableRoutes(routes, requestUrl) matches and loads hydration routes for the current request. A proxy can inspect route metadata without loading components through collectHydratableRoutes or matchHydratableRoutes. See the complete template in demo_ssr.

Capabilities and compatibility

| Scenario | Entry point | Status | |---|---|---| | Browser/hash/memory routing | react-view-router | Existing API preserved | | React Router v4/v5 collaboration | router.history.createHistory4() | [email protected]-compatible adapter over the shared ReactViewRouter history | | DOM render utilities | react-view-router/dom | Explicit package export | | Drawer router view | react-view-router/drawer | Explicit package export; styles are imported automatically | | Transition router view | react-view-router/transition | Explicit package export; styles are imported automatically | | React 18+ standalone SSR island | react-view-router/standalone-modern | Implemented and tested | | React 16.8/17 standalone SSR island | react-view-router/standalone-legacy | Implemented and tested | | React Native | core memory router | Supported without DOM/hydration adapters |

  • Core and the legacy standalone adapter still target Chrome 49. The React 16/Webpack 4 packed-package fixture, full ES5 syntax gate, modern Chromium behavior test, and a Windows Chrome 49.0.2623.75 smoke test all pass. Application bundlers must transform dynamic import() into a compatible chunk loader.
  • Framework-owned page routing is intentionally outside ReactViewRouter's supported scope. Use the framework router for the outer URL and do not mirror its route table into ReactViewRouter.
  • Existing Router/Route hooks are browser Client Component hooks and cannot execute in a React Server Component.

Documentation

| Document | Use it for | |---|---| | Complete API reference | Router, RouterView, RouterLink, route configuration, methods, HOCs, hooks, plugins, and runtime helpers. | | SSR and runtime adapters | Standalone hydration setup, ownership, compatibility, and fallbacks. | | Server Component boundaries | Client-only hooks and server-safe helpers. | | SSR route-island design | Protocol details and the compatibility matrix. | | Route guard plugin proposal | Planned guard-pipeline extraction and constraints. |

Online demo

ReactViewRouter playground — available after the first GitHub Pages deployment.

Deployment setup.

Runnable examples

| Example | Purpose | Entry | |---|---|---| | Standalone SSR | JSX, server/client separation, route-island hydration | demo_ssr | | Chrome 49 legacy | React 16, Webpack 4, ES5 bundle, real legacy-browser runner | fixtures/chrome49-legacy | | React Native | Memory routing, deep links, platform bridge | demo_native | | React 16 | React 16 integration | demo_react16 | | React 17 | Legacy React integration | demo_react17 | | React 18 | React 18 integration | demo_react18 | | React 19 | React 19 createRoot integration | demo_react19 | | Shared React app | JSX pages, nested lazy routes, named outlets, guard-order log | demo_react_shared |

Examples separate pages, routes, runtime adapters, and server/client entry points so their structure can be reused as a project baseline.

Current verification

npm test -- --runInBand
npm run build
npm run build-demo-site

These commands cover the library suites, package builds, runnable website, and static-site dependency checks without duplicating a quickly stale test count in the README. The Chrome 49 fixture additionally covers package consumption, ES5 parsing, modern Chromium behavior, and a Windows Chrome 49.0.2623.75 smoke test. Fixed-version verification does not imply coverage of every Chromium 49 embedding or ongoing security maintenance for legacy dependencies.