# react-async-loader

> Async script loading composition

Latest version **0.1.2** (published 2015-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-async-loader
pnpm add react-async-loader
yarn add react-async-loader
bun add react-async-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2015-11-30 |
| First published | 2015-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Edmund Hung |
| Maintainers | edstudio |
| Keywords | React, Async, Script Loader |

## Links

- npm: https://www.npmjs.com/package/react-async-loader
- Repository: https://github.com/EdStudio/react-async-loader
- Issues: https://github.com/EdStudio/react-async-loader/issues
- npm.io page: https://npm.io/package/react-async-loader

## Dependencies (1)

- [hoist-non-react-statics](https://npm.io/package/hoist-non-react-statics.md) ^1.0.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2015-11-30
- 0.1.1 — 2015-11-30
- 0.1.0 — 2015-11-30
- 0.0.2 — 2015-07-26

## README

react-async-loader
==================
Async scripts loading composition

Features include:
* jsonp support
* multiple scripts loading

Installation
------------

```
$ npm install react-async-loader
```

Usage
-----

```
// using an ES6 transpiler
import asyncLoad from 'react-async-loader';

// not using an ES6 transpiler
var asyncLoad = require('react-async-loader');
```


The only API `asyncLoad(mapScriptsToProps) => AsyncLoaded(Component)` receives 1 parameter and returns a function to connect with your Component.

* mapScriptsToProps (props => Config Object) - Configure scripts that are required to be injected into the component when loaded
* Component (React Component) - The component being wrapped

Config Object
- #key: The object key is the name that will be used when injecting the loaded script.
- globalPath: The script name to be injected from the global scope (window). E.g. google.maps
- url: The url of the script, exclude callback parameter for jsonp.
- jsonp: Optional. Append callback parameter to scriptUrl when true.

Example
-------
See this [GoogleMap example](https://github.com/EdStudio/react-async-loader/tree/master/example/)

Changelog
-------
[2015-11-30] Version 0.1.0

1. API Redesigned: Improve configurability based on Components properties (mapScriptsToProps)
2. Enable auto static function exposures with hoist-non-react-statics
3. Fix a bug with server side rendering (No window and document object)

License
-------
MIT

---
_Source: https://npm.io/package/react-async-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
