Skip to content

Conversation

marcospassos
Copy link

@marcospassos marcospassos commented May 13, 2025

A common need when using this library is to automatically select the user's country based on their IP or location. Since that's out of scope for this library (there's no reliable way to detect the user's country on the client side alone), I put together a simple template that integrates it with an external service.

The template uses Croct, which offers a free-forever plan and makes it super easy to detect the user’s country from their IP. We've been using it in all our contact forms, and it’s been super helpful for improving UX by pre-filling the country field automatically.

I also added a new section to the README with a one-line setup and usage example:

npx croct@latest use npm://react-phone-number-input

Here's what it looks like in action:
image

Hope this helps others who’ve run into the same need!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant