It's React. Something weird happens. When I reload directly from the browser, it still logs an empty array, but when I save the file from VSCode, it displays the array just like I wanted.
const [country, setCountry] = useState([]);
    
useEffect(() => {
  axios.get("https://restcountries.com/v3.1/all")
    .then((response) => {
      const data = response.data;
      const names = data.map((n) => n.name.common);
      setCountry(names);
      console.log(country);
    })
    .catch((error) => {
      console.log(error);
    });
}, []);