Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 988 Bytes

README.md

File metadata and controls

40 lines (27 loc) · 988 Bytes

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.