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.
- Host: GitHub
- URL: https://github.com/sanichkotikov/solid-use-script
- Owner: SanichKotikov
- License: mit
- Created: 2021-10-15T06:11:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-15T06:13:15.000Z (over 4 years ago)
- Last Synced: 2025-03-18T13:59:10.624Z (10 months ago)
- Topics: loader, npm-module, npm-package, solid-js, tiny-library
- Language: TypeScript
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
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' });
```