react-use-external-assets
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

react-use-external-assets

Append multiple scripts and stylesheets to the document body as functions

NPM JavaScript Style Guide

Install

npm install --save react-use-external-assets

Usage

import { useExternalScripts } from 'react-use-external-assets'

const Example = () => {
  const loadState = useExternalScripts([
      'https://my-domain.com/my-script.js'
  ])
  return (
    <div>
      {Object.values(loadState).every(s => s === 'ready') ? 'Everything is ready!' : 'Getting things ready...'}
    </div>
  )
}

License

MIT © wimoMisterX


This hook is created using create-react-hook.

Package Sidebar

Install

npm i react-use-external-assets

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

56.8 kB

Total Files

23

Last publish

Collaborators

  • wimomisterx