How can I useQuery when I click a button

I have this privateProcedure on the backend. I want to call it when I hit a button in my frontend:
checkDate: protectedProcedure
  .input(z.object({ date: z.date() }))
  .query(({ input, ctx }) => {
    return {
      message: 'hello world ' + input.date.toISOString(),
    };
  }),


How do I do that? I am btw gonna query a database for that date, and return something. I just simplified it for this example
Was this page helpful?