@semilayer/react 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/package.json +10 -10
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<p align="right">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/semilayer/semilayer/main/assets/logo.png" alt="SemiLayer" width="120" />
|
|
3
|
+
<br />
|
|
4
|
+
<strong>@semilayer/react</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="right">
|
|
8
|
+
React hooks for <a href="https://semilayer.com">SemiLayer</a> — <code>useSearch</code>, <code>useSimilar</code>, <code>useQuery</code>. Thin wrappers over <a href="https://www.npmjs.com/package/@semilayer/client"><code>@semilayer/client</code></a> that handle loading, error, and pagination state.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @semilayer/react @semilayer/client
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { SemiLayerProvider, useSearch } from '@semilayer/react'
|
|
23
|
+
|
|
24
|
+
function App() {
|
|
25
|
+
return (
|
|
26
|
+
<SemiLayerProvider apiKey={process.env.NEXT_PUBLIC_SEMILAYER_KEY!}>
|
|
27
|
+
<Search />
|
|
28
|
+
</SemiLayerProvider>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function Search() {
|
|
33
|
+
const { data, loading } = useSearch('articles', { query: 'renewable energy' })
|
|
34
|
+
if (loading) return <Spinner />
|
|
35
|
+
return <ul>{data?.map((r) => <li key={r.id}>{r.title}</li>)}</ul>
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See [semilayer.dev](https://semilayer.dev) for the full docs.
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semilayer/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "SemiLayer React hooks — useSearch, useSimilar, useQuery",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,15 +14,8 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsup",
|
|
19
|
-
"dev": "tsup --watch",
|
|
20
|
-
"lint": "eslint src/",
|
|
21
|
-
"typecheck": "tsc --noEmit",
|
|
22
|
-
"test": "vitest run"
|
|
23
|
-
},
|
|
24
17
|
"dependencies": {
|
|
25
|
-
"@semilayer/client": "
|
|
18
|
+
"@semilayer/client": "1.2.0"
|
|
26
19
|
},
|
|
27
20
|
"devDependencies": {
|
|
28
21
|
"@types/react": "^19.0.0",
|
|
@@ -33,5 +26,12 @@
|
|
|
33
26
|
},
|
|
34
27
|
"peerDependencies": {
|
|
35
28
|
"react": ">=19.0.0"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup",
|
|
32
|
+
"dev": "tsup --watch",
|
|
33
|
+
"lint": "eslint src/",
|
|
34
|
+
"typecheck": "tsc --noEmit",
|
|
35
|
+
"test": "vitest run"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|