tRPC basics - returning an array

I suspect this is my ignorance of typescript. I am just not getting anywhere with this tRPC set up. I just want to return an array, but my query result is empty. Router const partyList = [ { firstName: 'joe', lastName: 'linsley', age: 24 }, { firstName: 'bill', lastName: 'smith', age: 40 }, ] export const userRouter = router({ partyRoleRouter: publicProcedure.query(() => { return partyList; }), }); Page const peps = trpc.party.partyRoleRouter.useQuery(); console.log("Peps ",peps.data) if (!peps.data) return <div>Loading...</div>; Question peps is always undefined. Why??? how do I get the array of people in partyList?
3 Replies
cje
cje3y ago
cje
cje3y ago
not sure whats going on, maybe the bug is somewhere else
ibamsey
ibamseyOP3y ago
that's helpful. Thanks for taking the time.
Want results from more Discord servers?
Add your server