Skip to content

Commit a8b6c94

Browse files
authored
Merge pull request #103 from charlie-tango/fix/update-docs
Update readme
2 parents c1731f4 + f0754f4 commit a8b6c94

File tree

3 files changed

+191
-137
lines changed

3 files changed

+191
-137
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Collection of React Hooks used by [Charlie Tango](https://www.charlietango.dk/).
88
- Written in TypeScript, with full types support.
99
- Small and focused, each hook does one thing well.
1010
- No barrel file, only import the hooks you need.
11+
- Exported as ESM.
1112
- Optimized for modern React, uses newer APIs like `useSyncExternalStore`.
1213
- All hooks work in a server-side rendering environment.
1314
- All hooks are tested with [Vitest](https://vitest.dev/) in a real browser environment.
@@ -69,6 +70,8 @@ const prefersReducedMotion = useMedia(
6970
Keep track of the previous value of a variable.
7071

7172
```ts
73+
import { usePrevious } from "@charlietango/hooks/use-previous";
74+
7275
const prevValue = usePrevious(value);
7376
```
7477

@@ -81,6 +84,8 @@ The `useScript` hook will handle this for you.
8184
You can load the same script multiple times, and the hook will share the script and status between all instances.
8285

8386
```ts
87+
import { useScript } from "@charlietango/hooks/use-script";
88+
8489
const status = useScript("https://example.com/script.js"); // "idle" | "loading" | "ready" | "error"
8590
if (status === "ready") {
8691
// Script is loaded

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@
5959
"@vitest/browser": "^2.0.4",
6060
"bumpp": "^9.4.1",
6161
"globby": "^14.0.2",
62-
"husky": "^9.1.1",
62+
"husky": "^9.1.3",
6363
"lint-staged": "^15.2.7",
64-
"playwright": "^1.45.2",
64+
"playwright": "^1.45.3",
6565
"prettier": "^3.3.3",
6666
"react": "^18.0.0",
6767
"react-dom": "^18.0.0",
6868
"size-limit": "^11.1.4",
69-
"tsup": "^8.2.2",
70-
"typescript": "^5.5.3",
69+
"tsup": "^8.2.3",
70+
"typescript": "^5.5.4",
7171
"vitest": "^2.0.4"
7272
},
7373
"packageManager": "[email protected]+sha256.dae0f7e822c56b20979bb5965e3b73b8bdabb6b8b8ef121da6d857508599ca35"

0 commit comments

Comments
 (0)