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 SignIn (at PublicRoute.js:24)
import React, { useContext } from 'react'
import ConfigContext from '../../providers/Config/Context'
import { Route, Redirect, useHistory} from 'react-router-dom'
function PublicRoute({ component: Component, redirectTo = '/', ...rest }) {
const { appConfig } = useContext(ConfigContext)
const { auth } = appConfig || {}
const { useAuth } = auth || {}
const [isAuthorised] = useAuth()
const history = useHistory()
let _location = history.location
if (isAuthorised) {
if (_location.state && _location.state.from) {
redirectTo = redirectTo === '/' ? _location.state.from.pathname : redirectTo
}
}
return (
<Route
{...rest}
render={(props) =>
/* тут ошибка */ !isAuthorised ? (
<Component {...props} />
) : (
<Redirect
to={{
pathname: redirectTo,
search: `from=${props.location.pathname}`,
state: { from: props.location },
}}
/>
)
}
/>
)
}
export default PublicRoute
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 SignIn (at PublicRoute.js:24)