ylyubchenko / react-router-guard

React Router Guard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

React Router Guard

License:MIT License


Languages

Language:JavaScript 94.4%Language:CSS 3.8%Language:HTML 1.9%