I have a problem with my code. Here is my code in App.tsx
   function App() {
  const dispatch = useDispatch();
  const auth = useSelector((state: RootStateOrAny) => state.auth);
  const token = useSelector((state: RootStateOrAny) => state.token);
  useEffect(() => {
    const firstlogin = localStorage.getItem('firstlogin');
    if(firstlogin) {
      const getUserToken = async () => {
        const res: any = await axios.post('/user/refresh_token', null);
        dispatch({type: "GET_TOKEN", payload: res.data.access_token});
      };
      getUserToken();
    }
  }, [auth.isLogged, dispatch]);
  useEffect(() => {
    if(token){
      const getUser = () => {
        dispatch(dispatchLogin());
        return fetchUser(token).then(res => {
          dispatch(dispatchGetUser(res))
        })
      }
      getUser();
    }
  },[token, dispatch]);
  return (
    <Router>
      <div className="App">
        <Header/>
        <Body/>
      </div>
    </Router>
  );
}
export default App;
And when I try to access the state in my Home component, which is under the Body component. It gives me an error saying: "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."
This is my Home component:
import React from 'react';
import { useSelector, RootStateOrAny } from 'react-redux';
export default function Home() {
    
        const auth = useSelector((state: RootStateOrAny) => state.auth);
        const {username} = auth.user[0];
    return(
        <div>
            Welcome {username} !
        </div>
    )
};
And the Body Component:
export default function Body() {
    const auth = useSelector((state: RootStateOrAny) => state.auth);
    const {isLogged} = auth;
    
    return (
        <Switch>
            <Route path="/signup">
                {isLogged ? <Notfound/> : <Signup/>}
            </Route>
            <Route path="/login">
                {isLogged ? <Notfound/> : <Login/>}
            </Route>
            <Route path="/home">
                {isLogged ? <Home/> : <Login/>}
            </Route>
            <Redirect to="/home"/>
        </Switch>
    )
}
These are my reducers:
const initialState = {
    user: [],
    isAdmin: false,
    isLogged: false,
};
const authReducer = (state = initialState, action: any) => {
    switch(action.type) {
        case ACTIONS.LOGIN :
            return {
                ...state,
                isLogged: true
            }
        case ACTIONS.GET_USER : 
        return {
            ...state,
            user: action.payload.user
        }
        default:
            return state
    }
}
How can I fix this? Thank you.
 
    