trpc + server actions
Unanswered
astro posted this in #help-forum
astroOP
i wanted to use trpc without react query like with next's server actions but using a relative url throws error
import React from "react";
export default function ProjectList() {
async function getProjects() {
const data = await fetch("/api/trpc/getProjects");
return JSON.stringify(await data.json(), null, 2);
}
return <pre>{getProjects()}</pre>;
}1 Reply
astroOP
also whats the best way to setup trpc in next js without using react query(cuz i want to use server functions), currently im creating a server folder in src with index.ts and trpc.ts and inside /api i have /trpc/[trpc]/route.ts .