Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit 559ba1d

Browse files
committed
Add browser example to docs
1 parent b094f4b commit 559ba1d

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "🌐 Browser",
3+
"position": 3
4+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Browser Usage
2+
3+
Version 3.1.0 introduced official browser support.
4+
5+
Visit [Browser Support](../../browser-support/) for more information.
6+
7+
## Basic Usage
8+
9+
```tsx
10+
import { CheckResult } from '@version-checker/api'
11+
import versionCheck from '@version-checker/browser'
12+
import { useState } from 'react'
13+
import { useQuery } from 'react-query'
14+
15+
export default function App() {
16+
const { data } = useQuery<CheckResult['update'], any, CheckResult['update'], any>({
17+
queryKey: ['updater'],
18+
queryFn: async () => {
19+
const { update } = await versionCheck({
20+
owner: 'axelrindle',
21+
repo: 'github-version-checker',
22+
currentVersion: '1.2.3',
23+
})
24+
25+
return update
26+
}
27+
})
28+
29+
return (
30+
<p>
31+
{data === undefined ?
32+
(
33+
<p>
34+
No update found.
35+
</p>
36+
) :
37+
(
38+
<p>
39+
<b>{data?.name}</b>
40+
</p>
41+
)
42+
}
43+
</p>
44+
)
45+
}
46+
```

0 commit comments

Comments
 (0)