1.0.3 • Published 6 years ago

react-script-async v1.0.3

Weekly downloads
27
License
MIT
Repository
github
Last release
6 years ago

React Script Async

A dead simple way to load <script /> tags through render props.

Installation

npm install react-script-async

or

yarn add react-script-async

How it works

This library uses a render prop to render certain elements whether your script is loaded or not. All the props you usually would pass to a regular <script /> tag are passed through.

import React from 'react';
import Script from 'react-script-async';

export default () => (
  <Script src="some_script.js">
    {({ loaded }) => (loaded ? <div>hurray !</div> : <div>Loading...</div>)}
  </Script>
);
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago