English | [简体中文](./README.md)
# React-import-lazy
> `react-import-lazy` is used in React, and to load the packages asynchronously, a coomon case is to optimize the first page rendering time!
It provides two function, you can use what you need:
- `LazyImport()` based on [React Lazy](https://zh-hans.reactjs.org/docs/code-splitting.html#reactlazy) to render the component dynamicaly
- `AsyncImport()` based on `import().then()` function to import the component dynamicly
## Usage
Run `npm install react-import-lazy --save` or `yarn add react-import-lazy --save` to install it
Then you can use just like this
```javascript
import React from 'react'
import ReactDOM from 'react-dom'
import { LazyImport, AsyncImport } from 'react-import-lazy'
const Test = AsyncImport({
action: import('./App'),
loading: loading
})
ReactDOM.render(