I feel like this is pretty mon that people want a selector that when you pick a country it narrows down province/states to that country then you pick state or province and it narrows down the city for you. Is there nothing on NPM for that? I saw country selector and country-province but nothing that goes from country to city. If nothing exists should I store all those in the DB or front-end? I'm assuming DB.
I feel like this is pretty mon that people want a selector that when you pick a country it narrows down province/states to that country then you pick state or province and it narrows down the city for you. Is there nothing on NPM for that? I saw country selector and country-province but nothing that goes from country to city. If nothing exists should I store all those in the DB or front-end? I'm assuming DB.
Share Improve this question edited Sep 11, 2018 at 8:31 Hyyan Abo Fakher 3,5273 gold badges24 silver badges36 bronze badges asked Sep 10, 2018 at 19:01 GoobyGooby 7333 gold badges15 silver badges38 bronze badges 1- 1 Did you find any package? How did you add this type of selector? – Arpit Commented Jan 3, 2019 at 11:44
3 Answers
Reset to default 5You could use either of the two libraries.
- https://github./country-regions/react-country-region-selector [React Component -> Provides Country and State]
- https://www.npmjs./package/country-state-city, [Standalone Library which provides Country -> State -> City]
If you want to store the data and search results on your own, i would suggest you to stored it in a DB, loading the data on frontend would be expensive on network.
You can use this React ponent react-places-autoplete based on Google Places API.
I would remend using react country-state-city, but it consumes lot of space.