useScript ​
Hook that manages a script with onLoad, onError, and removeOnUnmount functionalities
typescript
import { useScript } from '@elysiumorg/solid-use';Usage ​
typescript
const status = useScript('https://example.com/script.js');
Demo ​
Api ​
Parameters
| Name | Type | Default | Note | 
|---|---|---|---|
| src | string | - | The source of the script | 
| options? | UseScriptOptions | - | The options of the script extends from attributes script tag | 
| options.removeOnUnmount? | boolean | true | Whether to remove the script on unmount | 
| options.async? | boolean | true | Whether to load the script asynchronously |