I want to convert this Redux lifestate to Redux hooks. As we see it's easy but I am getting problem while I use dispatch instead of setState().
 async componentDidMount() {
    try {
      await Auth.currentSession();
      this.userHasAuthenticated(true);
    } catch (e) {
      if (e !== "No current user") {
        alert(e);
      }
    }
    this.setState({ isAuthenticating: false });
  }
converted to hooks
   const isAuthentication = useSelector(state => state.isAuthinticating);
   const dispatch = useDispatch();
   useEffect(() => {
    async function fetchData(){
       try {
      await Auth.currentSession();
      this.userHasAuthenticated(true);
    } catch (e) {
      if (e !== "No current user") {
        alert(e);
      }
    }
    }
   fetchData();
   // problem begins here
   dispatch(stateName({type:'SET_AUTH', payload: false}));
   }
i was unable to use
dispatch(stateName({type:'SET_AUTH', payload: false}));
inside of useEffect. is it there way to do this
 
    