react-isomorphic-scriptloader
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

React Isomorphic ScriptLoader

React package to load scripts into your isomorphic (server side rendered) webapp.

Installation

npm install --save react-isomorphic-scriptloader

Example Usage

import React from 'react'
import Loader from 'react-isomorphic-scriptloader'
 
export default class MyComponent extends React.Component {
  state = { scriptsLoaded: false };
  render() {
    return (
      <div>
        <Loader src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places" onLoad={() => this.setState({ scriptsLoaded: true })} />
        { this.state.scriptsLoaded &&  <div>Yayy google maps loaded</div> }
        { !this.state.scriptsLoaded &&  <div>Please wait while google maps is being loaded</div> }
      </div>
    )
  }
}

License

This package is licensed under the terms of MIT License. See the LICENSE file for further information.

Readme

Keywords

Package Sidebar

Install

npm i react-isomorphic-scriptloader

Weekly Downloads

4

Version

2.0.0

License

MIT

Unpacked Size

5.33 kB

Total Files

7

Last publish

Collaborators

  • archcorsair