useQuery or useMutation?
What's the best way to handle side effects with React Query when making API calls in a chat application?
I'm building a chat app where each API response needs to update a conversation array in state. Currently using
Is
I'm building a chat app where each API response needs to update a conversation array in state. Currently using
useQuery with side effects in the queryFn, but I know this isn't ideal. Here's my current code:Is
useMutation a better choice here? Or should I handle state updates in a separate useEffect?