react-script-hook
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,4 +0,5 @@ | ||
export default function useScript({ src, ...attributes }: HTMLScriptElement): { | ||
loading: boolean; | ||
error: ErrorEvent | null; | ||
}; | ||
export interface ScriptProps { | ||
src: HTMLScriptElement['src']; | ||
[key: string]: any; | ||
} | ||
export default function useScript({ src, ...attributes }: ScriptProps): (boolean | ErrorEvent | null)[]; |
@@ -39,6 +39,3 @@ "use strict"; | ||
}, [src]); | ||
return { | ||
loading: loading, | ||
error: error | ||
}; | ||
return [loading, error]; | ||
} | ||
@@ -45,0 +42,0 @@ exports.default = useScript; |
{ | ||
"name": "react-script-hook", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "React hook to dynamically load an external script and know when its loaded", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -25,3 +25,3 @@ # react-script-hook | ||
function App() { | ||
const { loading, error } = useScript({ src: 'https://js.stripe.com/v3/' }); | ||
const [loading, error] = useScript({ src: 'https://js.stripe.com/v3/' }); | ||
@@ -28,0 +28,0 @@ if (loading) return <h3>Loading Stripe API...</h3>; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6683
54