Skip to content

Frontend / Backend routing for Redux / React applications running on client or server.

Notifications You must be signed in to change notification settings

ryan-mahoney/Universal-Route

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Universal Route

Universal Router is a small routing library for React.

A Router keeps your UI in sync with the URL. Universal Router is small because it is covers a specific use case.

  • associate URL patterns with a top-level React component
  • make an XHR request on each history transition, switch displayed component after success
  • start / stop progress page loading indicator

Defining Routes

routes.js

// NPM dependencies
import React from 'react';
import { helper } from 'universal-route';

// React component dependencies
import Home from './components/Home.js';
import About from './components/About.js';
import Staff from './components/Staff.js';

// associate paths to components
const routes = {
  '/':                    Home,
  '/about':               About,
  '/staff/:name':         Staff
};

// export the routes after prepating them
export default helper.prepare(routes);

About

Frontend / Backend routing for Redux / React applications running on client or server.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published