How do i fetch data from a TRPC endpoint in getStaticProps and getServerSideProps?

currently trying to do it like this
export async function getServerSideProps(context: any) {
  const { params, req, res } = context;
  const slug = params.slug;
  console.log("parandsfjknvedikv", slug);
  const { data } = api.profile.getUserByUsername.useQuery({
    username: "0xdead",
  });
  console.log("data", data);

  return {
    props: {
      hello: data,
    },
  };
}


throwing an error about how i cant use the useQuery hook in getServerSideProps which makes sense yeah? so how do i do that?
Was this page helpful?