TanStackT
TanStack2y ago
4 replies
specific-silver

How to return (useMutation) correctly in (Context API)?

In the first picture, I created a custom React hook for useMutation. Then I obtained the type of useMutation by hovering over the title of my function to use that type in the Context API.

In the second picture, I placed the type of my useSignUp/useMutation in the Context, but for the default value of the Context, I don't know what to put there.

What I want to happen is to call the signUp function from the Context API like this:

const { signUp } = useSession()

signUp.mutate(values)
1.jpg
2.jpg
Was this page helpful?