useScript

Dynamically load and inject external scripts.

Usage Example
1import { useScript } from '@danixsoft/hooks';
2
3function Example() {
4  const status = useScript('https://code.jquery.com/jquery-3.6.0.min.js');
5
6  return (
7    <div>
8      <p>Script status: {status}</p>
9      {status === 'ready' && <p>jQuery is ready!</p>}
10    </div>
11  );
12}