96.0.0 • Published 1 year ago

@null-studios/browser-router v96.0.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
gitlab
Last release
1 year ago

browser-router

Simplest client-side rendering browser router.

yarn add @null-studios/browser-router

Usage

import { ConfigurationRouter, Router } from 'browser-router';
import React, { FunctionComponent } from 'react';

// All application routes used to render different pages.
export const Configuration: ConfigurationRouter = {
  routes: [
    {
      name: 'About',
      path: '/about',
      type: 'page',
      destination: PageAbout,
    },
    {
      name: 'Sitemap',
      path: '/sitemap',
      type: 'page',
      destination: PageSitemap,
    },
    {
      name: '',
      path: '/',
      type: 'redirect',
      isExternal: false,
      destination: '/home',
    },
  ]
};

/*
 * Application router.
 */
export const ApplicationRouter: FunctionComponent = () => {
  return <Router configuration={Configuration} />;
};