export default function useCheckLogin(){ const [loginstate,setLoginState]=useState(false); let username=localStorage.getItem('user'); if(username!=null||username!=''){ setLoginState(true) } const history=useHistory(); if(!loginstate){ history.push("/"); } }
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/269307.html