How to use the inferno-router.Router.prototype function in inferno-router

To help you get started, we’ve selected a few inferno-router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bs32g1038 / node-blog / blog / src / router-util / matchRoutes.js View on Github external
import { Router, matchPath } from "inferno-router";

// ensure we're using the exact code for default root match
const { computeMatch } = Router.prototype;

const matchRoutes = (routes, pathname, /*not public API*/ branch = []) => {
  routes.some(route => {
    const match = route.path
      ? matchPath(pathname, route)
      : branch.length
        ? branch[branch.length - 1].match // use parent match
        : computeMatch(pathname); // use default "root" match

    if (match) {
      branch.push({ route, match });

      if (route.routes) {
        matchRoutes(route.routes, pathname, branch);
      }
    }
github infernojs / inferno / packages / inferno-router / __tests__ / transition.spec.jsx View on Github external
it("should have routeTo() method", () => {
    expect(Router.prototype.routeTo).toBeDefined();
  });

inferno-router

Provides routing functionality for Inferno

MIT
Latest version published 5 months ago

Package Health Score

79 / 100
Full package analysis