Can't perform a React state update on an unmounted component. #1514
-
Hello guys, I'm new to react-query, and so far it has been wonderful.
It gets thrown when I use the import { useMutation } from 'react-query';
import { useCSRF, useRefresh } from 'hooks/useQuery';
import { POST } from 'utils';
const useAuthMutation = () => {
const _csrf = useCSRF();
const { mutateAsync: loginMutate } = useMutation(
(data: { email: string; password: string }) =>
POST('/admin/login', {
...data,
_csrf,
}),
);
return {
login: loginMutate,
};
};
export default useAuthMutation; Any help or advice will be much appreciated, thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
can you maybe create a codesandbox example reproducing the problem? The |
Beta Was this translation helpful? Give feedback.
-
Sorry for the late reply, after some debugging, I noticed that the problem is coming from another component, sorry for the trouble. |
Beta Was this translation helpful? Give feedback.
Sorry for the late reply, after some debugging, I noticed that the problem is coming from another component, sorry for the trouble.