https://github.com/gwendall/react-script-async
A dead simple way to load <script /> tags through render props
https://github.com/gwendall/react-script-async
Last synced: 2 months ago
JSON representation
A dead simple way to load <script /> tags through render props
- Host: GitHub
- URL: https://github.com/gwendall/react-script-async
- Owner: gwendall
- License: mit
- Created: 2018-07-25T20:49:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-25T21:33:24.000Z (almost 7 years ago)
- Last Synced: 2025-03-18T05:56:57.712Z (3 months ago)
- Language: JavaScript
- Size: 107 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React Script Async
A dead simple way to load `` tags through render props.
# Installation
```shell
npm install react-script-async
```or
```shell
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 `` tag are passed through.
```javascript
import React from 'react';
import Script from 'react-script-async';export default () => (
{({ loaded }) => (loaded ? <div>hurray !</div> : <div>Loading...</div>)}
);
```