How to use the @jaredpalmer/after/asyncComponent function in @jaredpalmer/after

To help you get started, we’ve selected a few @jaredpalmer/after examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jaredpalmer / after.js / examples / basic / src / _routes.js View on Github external
import './index.css';
import React from 'react';
import asyncComponent from '@jaredpalmer/after/asyncComponent';
import Home from './Home';

export default [
  {
    path: '/',
    exact: true,
    component: Home,
  },
  {
    path: '/about',
    exact: true,
    component: asyncComponent({
      loader: () => import('./About'),
      Placeholder: () =&gt; <div>LOADING...</div>,
    }),
  },
  {
    path: '/redirect_test',
    redirectTo: '/',
    pathMatch: 'full',
  },
  {
    path: '**',
    component: () =&gt; 'Not Found!',
  },
];

@jaredpalmer/after

Build isomorphic Javascript applications with ease.

MIT
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis

Similar packages