fork from useScript
but with enhancing for creating multiple Script tag
npm install --save use-scripts
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>
)
}
MIT © irhamputra
This hook is created using create-react-hook.