Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

react-external-script-loader

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Issues
File Explorer

Advanced tools

react-external-script-loader

React component for loading external scripts

    0.0.1latest

Version published
Maintainers
1
Yearly downloads
10,331
increased by286.93%

Weekly downloads

Changelog

Source

Initial release

Readme

Source

react-external-script-loader

Library for loading external scripts

Install

npm install react-external-script-loader yarn add react-external-script-loader

Usage

import Loader from 'react-external-script-loader'; ... <Loader url="https://vk.com/js/api/openapi.js?160" global="VK" />

Component

Options

PropertyTypeDescription
url(required)stringUrl of external script
global(required)stringname of object if it loads successfully
optionsobjectScript options - possible keys: {type, charset, async, defer}. You can ckeck it here
onLoadfunctionCalled when script loaded (global: object): void
onErrorfunctionCalled when script loading was failed void

Basic example

import Loader from 'react-external-script-loader'; class App extends React.Component { state = { load: false, }; render() { const { load } = this.state; return ( <div className="App"> <h1>React External Script Loader Example</h1> <button onClick={() => this.setState({ load: true })}> Load external script </button> {load && ( <> <div id="vk_playlist_-2000646569_646569" /> <Loader url="https://vk.com/js/api/openapi.js?160" global="VK" onLoad={VK => VK.Widgets.Playlist( 'vk_playlist_-2000646569_646569', -2000646569, 646569, 'ae82627d6c8bb4500d', ) } /> </> )} </div> ); } } const rootElement = document.getElementById('root'); ReactDOM.render(<App />, rootElement);

You can clone this repository and check example

git clone https://github.com/mmarkelov/react-external-script-loader.git cd ./react-external-script-loader/example yarn && yarn run dev

TODO

Keywords

FAQs

What is react-external-script-loader?

React component for loading external scripts

Is react-external-script-loader popular?

The npm package react-external-script-loader receives a total of 174 weekly downloads. As such, react-external-script-loader popularity was classified as not popular.

Is react-external-script-loader well maintained?

We found that react-external-script-loader demonstrated a not healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.

Last updated on 27 Feb 2019
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc