react-router-guard
v2.3.1
Published
React Router Guard
Downloads
584
Maintainers
Readme
Install
npm
npm install --save react-router-guard
yarn
yarn add react-router-guard
Introduction
React Router Guard is a router structure base on react-router-dom, when you install react-router-guard you don't need to install (react-router-dom, history, react-loadable) because it uses these packages as dependencies, it gives you some cool feature like router-config, code splitting, router authentication support, dynamic redirect for more information please read the demo and docs
Usage
import React from 'react';
import ReactDOM from 'react-dom';
/*
Because we don't need to install react-router-dom so you can use Link or NavLink from 'react-router-guard'
import { RouterGuard, BrowserRouter, Link, NavLink, Redirect, Route, Router, Switch, history, withRouter, Loadable } from 'react-router-guard';
*/
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
Docs
Screenshot & Demo
React Router Guard