Spaces:
Paused
Paused
File size: 410 Bytes
054d282 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
"use client";
import { useEffect, useState } from "react";
export default function CountryLookup() {
const [country, setCountry] = useState("United States");
useEffect(() => {
fetch(
`https://extreme-ip-lookup.com/json/?key=${process.env.NEXT_PUBLIC_IP_API_KEY}`
)
.then((res) => res.json())
.then((data) => setCountry(data.country));
}, []);
return <div>{country}</div>;
}
|