Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 550 Bytes

README.md

File metadata and controls

31 lines (26 loc) · 550 Bytes

react-loadable

naive react loadable

Install

yarn add @tfboys/loadable

Example

import Loadable from '@tfboys/loadable';

const LazyLoading = loadable({
    loader: () => {
        return new Promise((resolve, reject) => {
            // wait 2 seconds
            setTimeout(() => {
                resolve(import('./route/lazy-loading'))
            }, 2000);
        })
    },
    loading: () => { return 'loading' },
})

export default class App extends React.Component {
  render() {
    return <LazyLoading/>;
  }
}