Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-script-hook

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-script-hook - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

7

lib/use-script.js

@@ -44,6 +44,8 @@ "use strict";

var _d = (0, react_1.useState)(status ? status.error : null), error = _d[0], setError = _d[1];
// Tracks if script is loaded so we can avoid duplicate script tags
var _e = (0, react_1.useState)(false), scriptLoaded = _e[0], setScriptLoaded = _e[1];
(0, react_1.useEffect)(function () {
// Nothing to do on server, or if no src specified, or
// if loading has already resolved to "loaded" or "error" state.
if (!isBrowser || !src || !loading || error)
// if script is already loaded or "error" state.
if (!isBrowser || !src || scriptLoaded || error)
return;

@@ -85,2 +87,3 @@ // Check again for existing <script> tags with this src

setLoading(false);
setScriptLoaded(true);
};

@@ -87,0 +90,0 @@ var handleError = function (error) {

{
"name": "react-script-hook",
"version": "1.7.0",
"version": "1.7.1",
"description": "React hook to dynamically load an external script and know when its loaded",

@@ -26,3 +26,4 @@ "keywords": [

"lint": "eslint '*/**/*.{js,ts,tsx}' --report-unused-disable-directives",
"prepare": "npm run build"
"prepare": "npm run build",
"release": "release-it"
},

@@ -55,2 +56,3 @@ "peerDependencies": {

"react-test-renderer": "^17.0.2",
"release-it": "^15.4.1",
"rimraf": "^3.0.2",

@@ -60,2 +62,2 @@ "ts-jest": "^27.0.3",

}
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc