New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-router-guard

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-guard

React Router Guard

latest
Source
npmnpm
Version
2.3.1
Version published
Weekly downloads
101
27.85%
Maintainers
1
Weekly downloads
 
Created
Source

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 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

nametypedescription
configRouterGuardConfigProps[]The config for render all route
historycreateBrowserHistory()To use custom history

Docs

Migrating from 1.x to 2.x

Docs

Screenshot & Demo

Demo

React Router Guard

License

MIT © TSL

Keywords

react

FAQs

Package last updated on 11 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts