useExternalScript
The useExternalScript
hook allows you to dynamically load an external script in your React component.
Add the utility
Return
This hook returns an object containing the following properties:
loading
: A boolean indicating whether the script is currently loading.error
: A boolean indicating whether there was an error loading the script.retryScriptLoad
: A function that can be called to retry loading the script.
Parameters
src
: A string representing the URL of the external script to load.