Closed fsiatama closed 5 months ago
@fsiatama I opened an issue in the React Phone Number Input repository.
And the creator of the package responded as follows:
Hmm, I see. Well, in that case just import the validation functions from
libphonenumber-js
package because all those functions are simply re-exported from that package.
libphonenumber-js
package is a dependency ofreact-phone-number-input
and is automatically installed.
Hi,
I think this could be mentioned in the readme for the time being.
Hello,
I've encountered an issue when using server actions with Next.js and attempting to validate phone numbers on the server side.
Currently, the documentation/code suggests using:
import { isValidPhoneNumber } from "react-phone-number-input";
However, this import is client-side oriented and might not be suitable for server-side validations due to its dependency on the react-phone-number-input package, which is primarily designed for client-side React applications.
For server-side validations within Next.js server actions, it's more appropriate to use:
import { isValidPhoneNumber } from 'libphonenumber-js';