How would I change componentDidMount(), componentWillReceiveProps(nextProps) to useEffect? I just cannot figure it out.
this one below is my code without using Hook. getting this.props.auth from reducers.
componentDidMount() {
  if (this.props.auth.isAuthenticated) {
     this.props.history.push('/main');
  }
}
componentWillReceiveProps(nextProps) {
        if (nextProps.auth.isAuthenticated) {
            this.props.history.push('/main');
        }
}
What I want to do here is to use Hook useEffect. I'm not figuring out how to pass this.props.auth.
import React, { useState,useEffect} from "react";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
const LoginPage = () =>{
   const navigate = useNavigate(); 
   //componentDidMount()
   useEffect(() => {
       if (this.props.auth.isAuthenticated) {
            navigate('/main');
        }
       
   }, [])
   //componentWillReceiveProps(nextProps)
   useEffect((nextProps) => {
       if (this.props.auth.isAuthenticated) {
            navigate('/main');
        }
       
   }, )
}
 
    