32 |
33 | {getTodos?.data?.map((todo) => (
34 |
35 | {
41 | setDone.mutate({
42 | id: todo.id,
43 | done: todo.done ? 0 : 1,
44 | });
45 | }}
46 | />
47 |
48 |
49 | ))}
50 |
51 |
52 |
53 | setContent(e.target.value)}
57 | className="flex-grow text-black bg-white rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 px-4 py-2"
58 | />
59 |
70 |
71 |
72 | );
73 | }
74 |
--------------------------------------------------------------------------------
/src/app/_trpc/Provider.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 | import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3 | import { httpBatchLink } from "@trpc/client";
4 | import React, { useState } from "react";
5 |
6 | import { trpc } from "./client";
7 |
8 | export default function Provider({ children }: { children: React.ReactNode }) {
9 | const [queryClient] = useState(() => new QueryClient({}));
10 | const [trpcClient] = useState(() =>
11 | trpc.createClient({
12 | links: [
13 | httpBatchLink({
14 | url: "http://localhost:3000/api/trpc",
15 | }),
16 | ],
17 | })
18 | );
19 | return (
20 |