T
TanStack2y ago
rare-sapphire

Best approach when there is no matching query endpoint to a mutation endpoint

I currently only have a POST endpoint for a mutation without a corresponding GET endpoint. What is the best approach if i need the data in another component after a mutation? 1. Put data in client state manager, e.g. put data in a zustand store in onSuccess callback of the mutation 2. Create the GET Endpoint and use a query. 3. Use a query without queryFn and update the value through the mutation. 4. other? According to the issues i read 3. should be bad but it would be my preferred solution in the sense i want to try to write my application without client state (to understand how to think about it) while also not adding an Endpoint that is actually not needed.
1 Reply
quickest-silver
quickest-silver2y ago
5. useMutationState

Did you find this page helpful?