From 94a55c63d2b34b5f65db6eb0937d0c2cf8047707 Mon Sep 17 00:00:00 2001 From: Nwadike Philip <56981537+epicdevler@users.noreply.github.com> Date: Fri, 14 Nov 2025 13:10:27 +0000 Subject: [PATCH] Set isLoading to false at default: when a country is passed the useEffect is ended and it leaves the loading state as default state, which was true. --- index.js | 2 +- package-lock.json | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 package-lock.json diff --git a/index.js b/index.js index 2459b58..32bc686 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ import { useState, useEffect } from "react"; const useGeoLocation = (options = {}) => { const [country, setCountry] = useState(options.country); const [error, setError] = useState(false); - const [isLoading, setIsLoading] = useState(true); + const [isLoading, setIsLoading] = useState(false); const api = options.api || "https://api.country.is"; useEffect(() => { diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..779bc8f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "react-ipgeolocation", + "version": "1.4.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "react-ipgeolocation", + "version": "1.4.0", + "license": "ISC" + } + } +}