![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
country-city-search
Advanced tools
The process of accessing and utilizing country and city information programmatically, making it a valuable tool for developers working with geographic data in their projects.
A Project to get Data about the country cities and states according the request.
Install country city search with npm
npm i country-city-search
import { getAllCountries, getCitiesByStateAndCountry, getCityByNameAndCountryData, searchCityByName } from "country-city-search";
const Home = () => {
const fetchData = async () => {
//Get All Countries Name with country code in single array
const allCountries = await getAllCountries();
// Output : ['Afghanistan (AF)', 'Albania (AL)',....]
//------------------------------------------------------
//Get City object using city name, state name and country name
const cityObject = await getCityByNameAndCountryData({
cityName: "rajkot",
state_name: "gujarat",
country_name: "India",
});
/*Output :
{
country_code: "IN";
country_id: "101";
country_name: "India";
id: "133679";
latitude: "22.33333000";
longitude: "70.83333000";
name: "Rajkot";
state_code: "GJ";
state_id: "4030";
state_name: "Gujarat";
time_zone_name: "Asia/Kolkata";
wikiDataId: "Q11854";
}
*/
//------------------------------------------------------------
//Get List array of cities object using state and country name
const allCitiesFromState = await getCitiesByStateAndCountry("gujarat", "India");
/*
Output :
[{
"id": "57588",
"name": "Abrama",
"state_id": "4030",
"state_code": "GJ",
"state_name": "Gujarat",
"country_id": "101",
"country_code": "IN",
"country_name": "India",
"latitude": "20.85865000",
"longitude": "72.90648000",
"wikiDataId": "Q490916",
"time_zone_name": "Asia/Kolkata"
}....]
*/
//------------------------------------------------------------
//Search City by it's Name
const city = await searchCityByName("ahmedabad");
/*
Output :
[
{
"id": "57606",
"name": "Ahmedabad",
"state_id": "4030",
"state_code": "GJ",
"state_name": "Gujarat",
"country_id": "101",
"country_code": "IN",
"country_name": "India",
"latitude": "23.02579000",
"longitude": "72.58727000",
"wikiDataId": "Q1070",
"time_zone_name": "Asia/Kolkata"
}, ...
]
*/
//------------------------------------------------------------
//Get country by its Country code
const country = await getCountryByCode("IN");
/*
Output =
[
{
name: "India",
iso3: "IND",
iso2: "IN",
numeric_code: "356",
phone_code: "91",
capital: "New Delhi",
currency: "INR",
currency_name: "Indian rupee",
currency_symbol: "₹",
tld: ".in",
native: "भारत",
region: "Asia",
region_id: "3",
subregion: "Southern Asia",
subregion_id: "14",
nationality: "Indian",
timezones: [...],
translations: {....},
latitude: "20.00000000",
longitude: "77.00000000",
emoji: "🇮🇳",
emojiU: "U+1F1EE U+1F1F3",
}
];
*/
//------------------------------------------------------------
//Get All States List from the country code
const state = await getStatesOfCountry("IN");
/* Output :
[
{
"id": 4023,
"name": "Andaman and Nicobar Islands",
"state_code": "AN",
"latitude": "11.74008670",
"longitude": "92.65864010",
"type": "Union territory"
} ....]
*/
//------------------------------------------------------------
//Get All States List from the country code
const cityies = await getAllCitiesOfState("BDS");
/* Output :
[
{
"id": "52",
"name": "Ashkāsham",
"state_id": "3901",
"state_code": "BDS",
"state_name": "Badakhshan",
"country_id": "1",
"country_code": "AF",
"country_name": "Afghanistan",
"latitude": "36.68333000",
"longitude": "71.53333000",
"wikiDataId": "Q4805192",
"time_zone_name": "Asia/Kabul",
"emoji": "🇦🇫",
"currency_symbol": "؋"
}....]
*/
};
useEffect(() => {
fetchData();
});
return (
<>
<div> Simple Examples for country-city-search package</div>
</>
);
};
For support, email dharmeshpal42@gmail.com
FAQs
The process of accessing and utilizing country and city information programmatically, making it a valuable tool for developers working with geographic data in their projects.
The npm package country-city-search receives a total of 0 weekly downloads. As such, country-city-search popularity was classified as not popular.
We found that country-city-search demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.