New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-async-loader

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-async-loader

Async script loading composition

latest
Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
2.8K
0.07%
Maintainers
1
Weekly downloads
 
Created
Source

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

Changelog

[2015-11-30] Version 0.1.0

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

License

MIT

Keywords

React

FAQs

Package last updated on 30 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts