1.0.0 • Published 3 years ago

use-scripts v1.0.0

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

useScripts

fork from useScript but with enhancing for creating multiple Script tag

NPM JavaScript Style Guide

Install

npm install --save use-scripts

Usage

import * as React from 'react'

import { useScripts } from 'use-scripts'

const Example = () => {
  const status = useScripts(['script_1.js', 'https://example.com/script-external.js']);
  
  return (
    <div>
      {status === "ready" && 'do something'}
      {status === "load" && 'do something'}
      {status === "error" && 'do something'}
      {status === "idle" && 'do something'}
    </div>
  )
}

License

MIT © irhamputra


This hook is created using create-react-hook.