Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-react-component

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-react-component

Async component loaded based webpack 3 for react-router 4

  • 0.7.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
48
decreased by-30.43%
Maintainers
1
Weekly downloads
 
Created
Source

npm-version license bower-license

async-react-component

Async component loaded based webpack 3 for react-router 4.

Install

It is recommended to run webpack on node 6.x or higher.

Install the pkg with npm:

npm install async-react-component --save

or yarn

yarn add async-react-component

or bower

bower install async-react-component

Usage

For react-router 4:

import {BrowserRouter as Router, Route, Switch} from 'react-router-dom';
import {getAsyncComponent} from 'async-react-component';

// code splitting in webpack 3: https://webpack.js.org/guides/code-splitting/#dynamic-imports
const App = () => import(/* webpackChunkName: "main" */ '../general/app/index');
const Info = () => import(/* webpackChunkName: "info" */ '@components/info/index');

const RootApp = () => {
    return (
        <Router>
            <Switch>
                <Route exact path='/' component={getAsyncComponent(App)}></Route>
                <Route path='/info' component={getAsyncComponent(Info)}></Route>
                <Route render={() => <div>404 not found</div>}></Route>
            </Switch>
        </Router>
    );
};

ReactDOM.render(
    RootApp,
    document.getElementById('app')
);

License

MIT

Keywords

FAQs

Package last updated on 13 Aug 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc