An open API service indexing awesome lists of open source software.

https://github.com/gwuhaolin/get-component-async

react component load for webpack async code split
https://github.com/gwuhaolin/get-component-async

code-splitting webpack

Last synced: 11 months ago
JSON representation

react component load for webpack async code split

Awesome Lists containing this project

README

          

# get-component-async

load component async for react router

## Use

install by:

```bash
npm i -S get-component-async
```

#### For react router

```jsx harmony
import getComponentAsync from "get-component-async";

import("./sub")
)}
/>
;
```

`./sub` is code is:

```jsx harmony
export default class Sub extends Component {
render() {
return

sub
;
}
}
```

#### For big component

```jsx harmony
import { getElementAsync } from "get-component-async";


...others
{getElementAsync(() => import("./bigComponent"))}
;
```

#### Show loading before loaded

```jsx harmony
import { getElementAsync } from "get-component-async";


...others
{getElementAsync(() => import("./bigComponent"), , props)}
;
```

#### Set default loading before loaded

```jsx harmony
import { setDefaultLoading } from "get-component-async";

setDefaultLoading();
```