const logout = useCallback(() =>{ dispatch({type: 'LOGOUT'}); setUser(null); window.location.reload(); //the old version is history.push('/'), this cause a error when user log in, refresh the page, log out, then SIGN IN button doesn't work, I have no idea why it happens },[dispatch])