注销时出现此错误。
下面的部分是身份验证条件。
错误
index.js:1 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
in Query (at auth.js:8)
in Unknown (at App.js:29)
auth.js
import React from "react";
import { Query } from "react-apollo";
import { GET_ACTIVE_ADMIN } from "../queries";
import { Redirect } from "react-router-dom";
const auth = condition => Component => props => (
<Query query={GET_ACTIVE_ADMIN}>
{({ data, loading }) => {
if (loading) return <div>Loading</div>;
return condition(data) ? <Component {...props} /> : <Redirect to="/" />;
}}
</Query>
);
export default auth;