How do I actually use tRPC without using a server component
Here is the error I'm getting:
and this is concerning this file:
2 Replies
I deleted some pieces of the code in form.tsx but that file runs fine its just I don't know how to use the api to mutate data without using a server component
You are trying to use the api endpoint from the server in
import { api } from "@/trpc/server";
In order to use the trpc api from your client components, you would need to use import { api } from "~/trpc/react";
. Or of course use a @
if that's your alias. The api is exported from the trpc
folder, not the server folder. In a file called react.tsx