@gonvex/react 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +65 -0
  2. package/package.json +5 -4
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @gonvex/react
2
+
3
+ React bindings for Gonvex.
4
+
5
+ This package provides the provider and hooks used by generated Gonvex bindings:
6
+ `useQuery`, `useMutation`, `useAction`, auth-aware providers, and Convex-style
7
+ compatibility exports.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @gonvex/react @gonvex/client
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+ import { GonvexClient } from "@gonvex/client";
19
+ import { GonvexProvider, useMutation, useQuery } from "@gonvex/react";
20
+ import { api } from "./gonvex/_generated/api";
21
+
22
+ const client = new GonvexClient("ws://localhost:8080/ws", {
23
+ project: "my-project",
24
+ });
25
+
26
+ export function AppRoot() {
27
+ return (
28
+ <GonvexProvider client={client}>
29
+ <Tasks />
30
+ </GonvexProvider>
31
+ );
32
+ }
33
+
34
+ function Tasks() {
35
+ const tasks = useQuery(api.tasks.list, { status: "open" });
36
+ const createTask = useMutation(api.tasks.create);
37
+
38
+ return (
39
+ <button onClick={() => void createTask({ title: "New task" })}>
40
+ {tasks?.length ?? 0} open tasks
41
+ </button>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ## Convex Compatibility
47
+
48
+ The package also exports Convex-style names for incremental migration:
49
+
50
+ - `ConvexProvider`
51
+ - `ConvexProviderWithAuth`
52
+ - `ConvexReactClient`
53
+ - `useConvex`
54
+ - `useConvexAuth`
55
+ - `usePaginatedQuery`
56
+
57
+ ## Related Packages
58
+
59
+ - `@gonvex/client` - browser WebSocket client
60
+ - `@gonvex/protocol` - shared protocol types
61
+ - `@gonvex/cli` - generated bindings and runtime sync
62
+
63
+ ## Documentation
64
+
65
+ Full docs live at https://desarso.github.io/gonvex/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonvex/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,8 +13,8 @@
13
13
  },
14
14
  "types": "./dist/index.d.ts",
15
15
  "dependencies": {
16
- "@gonvex/client": "0.1.0",
17
- "@gonvex/protocol": "0.1.0"
16
+ "@gonvex/client": "0.1.2",
17
+ "@gonvex/protocol": "0.1.2"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "react": ">=19"
@@ -25,7 +25,8 @@
25
25
  },
26
26
  "main": "./dist/index.js",
27
27
  "files": [
28
- "dist"
28
+ "dist",
29
+ "README.md"
29
30
  ],
30
31
  "scripts": {
31
32
  "build": "tsc -p tsconfig.json",