mirror of
https://github.com/gregberge/loadable-components.git
synced 2026-01-25 15:24:15 +00:00
50 lines
2.5 KiB
Markdown
50 lines
2.5 KiB
Markdown
<h1 align="center">
|
|
<img src="https://raw.githubusercontent.com/smooth-code/loadable-components/master/resources/loadable-components.png" alt="loadable-components" title="loadable-components" width="300">
|
|
</h1>
|
|
<p align="center" style="font-size: 1.2rem;">React code splitting made easy. Reduce your bundle size without stress ✂️✨.</p>
|
|
|
|
[](https://github.com/smooth-code/loadable-components/blob/master/LICENSE)
|
|
[](https://www.npmjs.com/package/@loadable/component)
|
|
[](https://www.npmjs.com/package/@loadable/component)
|
|
[](https://travis-ci.org/smooth-code/loadable-components)
|
|

|
|
[](https://david-dm.org/smooth-code/loadable-components?path=packages/component)
|
|
[](https://david-dm.org/smooth-code/loadable-components?type=dev)
|
|
[](https://unpkg.com/@loadable/component/dist/loadable.min.js)
|
|
|
|
```bash
|
|
npm install @loadable/component
|
|
```
|
|
|
|
## [Docs](https://www.smooth-code.com/open-source/loadable-components)
|
|
|
|
**See the documentation at [smooth-code.com/open-source/loadable-components](https://www.smooth-code.com/open-source/loadable-components)** for more information about using Loadable Components!
|
|
|
|
Quicklinks to some of the most-visited pages:
|
|
|
|
- [**Getting started**](https://www.smooth-code.com/open-source/loadable-components/docs/getting-started/)
|
|
- [Comparison with React.lazy](https://www.smooth-code.com/open-source/loadable-components/docs/loadable-vs-react-lazy/)
|
|
- [Server Side Rendering](https://www.smooth-code.com/open-source/loadable-components/docs/server-side-rendering/)
|
|
|
|
## Example
|
|
|
|
```js
|
|
import loadable from '@loadable/component'
|
|
|
|
const OtherComponent = loadable(() => import('./OtherComponent'))
|
|
|
|
function MyComponent() {
|
|
return (
|
|
<div>
|
|
<OtherComponent />
|
|
</div>
|
|
)
|
|
}
|
|
```
|
|
|
|
## License
|
|
|
|
Licensed under the MIT License, Copyright © 2017-present Smooth Code.
|
|
|
|
See [LICENSE](./LICENSE) for more information.
|