"use client"; import { useState } from "react"; import { api } from "@/trpc/react"; export function LatestPost() { // const { data: latestPost } = api.post.getLatest.useQuery(); const utils = api.useUtils(); const [name, setName] = useState(""); const createPost = api.post.create.useMutation({ onSuccess: async () => { await utils.post.invalidate(); setName(""); }, }); return (
Your most recent post: {latestPost.name}
) : (You have no posts yet.
)} */}