advtA
tRPC2y ago
4 replies
advt

trpc + server actions

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>;
}
image.png
Was this page helpful?