p6l.richard
p6l.richard
TtRPC
Created by p6l.richard on 11/3/2023 in #❓-help
How can I use `onSettled` in the `experimental_createTRPCNextAppDirClient`?
Got you.
8 replies
TtRPC
Created by p6l.richard on 11/3/2023 in #❓-help
How can I use `onSettled` in the `experimental_createTRPCNextAppDirClient`?
but it seems that experimental_createTRPCNextAppDirClient is intended for client but doesn't return a useMutation. does that mean that if I want to useMutation, i stay on v10?
8 replies
TtRPC
Created by p6l.richard on 11/3/2023 in #❓-help
How can I use `onSettled` in the `experimental_createTRPCNextAppDirClient`?
Or would the nextjs style to handling this be something like: - use React's useFormState hook https://react.dev/reference/react-dom/hooks/useFormState for form state (or the form library of your choice) - move the trpc mutation in a server action ?
8 replies
TtRPC
Created by Spoeky on 10/28/2023 in #❓-help
TRPC with Nextjs 13 App Router
Without knowing the context, my assumption is that you're using the api exported from app_trpc/client.ts in the app/page.tsx, which is a page without the use client directive. If you're using a mutation in a form (or similar), simply move that form into it's own component (separate from the page.tsx) and add "use client" in the first line of the file. Then import your NewForm component from page.tsx and this error should go away.
2 replies