Skip to content

clayrisser/react-router-defer

Repository files navigation

react-router-defer

GitHub stars

Adds deferred asynchronous rendering to react router

Please ★ this repo if you found it useful ★ ★ ★

Features

  • Adds asynchronous componentDefer method prop to Route component
  • Adds asynchronous renderDefer method prop to Route component
  • Adds asynchronous deferred hook to history.push

Installation

npm install --save react-router-defer

Dependencies

Usage

import React, { Component } from 'react';
import { Switch, Route } from 'react-router-defer';

export default class Routes extends Component {
  render() {
    return (
      <Switch>
        <Route exact path="/" componentDefer={() => import('./Home')} />
        <Route componentDefer={() => import('./NotFound')} />
      </Switch>
    );
  }
}

Contribute usage docs

Support

Submit an issue

Screenshots

Contribute a screenshot

Contributing

Review the guidelines for contributing

License

MIT License

Jam Risser © 2018

Changelog

Review the changelog

Credits

Support on Liberapay

A ridiculous amount of coffee ☕ ☕ ☕ was consumed in the process of building this project.

Add some fuel if you'd like to keep me going!

Liberapay receiving Liberapay patrons

About

Adds deferred asynchronous rendering to react router

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published