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])
// making all uppercase
city.toUpperCase();
//removing spaces and making all lowercase
city = city.trim().toLowerCase();
//capitalizing the first letter
cityCapitalized = city.charAt(0).toUpperCase() + city.slice(1);
Comments