1.0.0 • Published 2 years ago

react-use-external-assets v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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.