Skip to content

Commit 87ee481

Browse files
update imports in README
1 parent ec94388 commit 87ee481

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,20 @@ Running a mutation looks like
6666

6767
```svelte
6868
<script>
69-
const client = useConvexClient();
70-
71-
let toSend = $state('');
72-
let author = $state('me');
73-
74-
function onSubmit(e: SubmitEvent) {
75-
const data = Object.fromEntries(new FormData(e.target as HTMLFormElement).entries());
76-
client.mutation(api.messages.send, {
77-
author: data.author as string,
78-
body: data.body as string
79-
});
80-
}
69+
import { api } from "../../convex/_generated/api.js"; // depending on file location
70+
import { useConvexClient, useQuery } from "convex-svelte";
71+
const client = useConvexClient();
72+
73+
let toSend = $state('');
74+
let author = $state('me');
75+
76+
function onSubmit(e: SubmitEvent) {
77+
const data = Object.fromEntries(new FormData(e.target as HTMLFormElement).entries());
78+
client.mutation(api.messages.send, {
79+
author: data.author as string,
80+
body: data.body as string
81+
});
82+
}
8183
</script>
8284
8385
<form on:submit|preventDefault={onSubmit}>

0 commit comments

Comments
 (0)