/react-router-guard

React Router Guard

Primary LanguageJavaScriptMIT LicenseMIT

React Router Guard

NPM JavaScript Style Guide

Install

npm

npm install --save react-router-guard

yarn

yarn add react-router-guard

Introduction

React Router Guard is a fully solution for react router system it include react-router-dom and support structure for you, the main feature includes (react router config as object, route-based code splitting and authentication router, router loading animation), use can using it by the easy way react-router-guard will be helps you save a lot of time to setup a react router system, for more information please read demo and docs

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import { RouterGuard } from 'react-router-guard';
import config from './config';

function App() {
  return (
    <div className="App">
      <RouterGuard config={config} />
    </div>
  );
}

const rootElement = document.getElementById('root'); // eslint-disable-line
ReactDOM.render(<App />, rootElement);

API

name type default description
Config Array[Object] The config for render all route
loading Boolean|React.Element true The loading config for router
history createHashHistory() null Default router guard using createBrowserHistory you can change to hashHistory by pass history as props

Docs

Migrating from 1.x to 2.x

Docs

Screenshot & Demo

Demo

React Router Guard

License

MIT © TSL