An open API service indexing awesome lists of open source software.

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

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>)}

);
```