An open API service indexing awesome lists of open source software.

https://github.com/sanichkotikov/solid-use-script

Solid hook to dynamically load an external script.
https://github.com/sanichkotikov/solid-use-script

loader npm-module npm-package solid-js tiny-library

Last synced: 10 months ago
JSON representation

Solid hook to dynamically load an external script.

Awesome Lists containing this project

README

          

# solid-use-script

Solid hook to dynamically load an external script.

```bash
npm i -S solid-use-script
```

## Usage

```typescript jsx
import { Switch, Match } from 'solid-js';
import { useScript } from 'solid-use-script';

function App() {
const [loading, error] = useScript('https://some.api');

return (
...}>
Loading API...
Failed to load API: {error().message}

);
}
```

### Attributes

```typescript
useScript('https://some.api', { crossorigin: 'anonymous' });
```