You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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';
The text was updated successfully, but these errors were encountered:
@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 of react-phone-number-input and is automatically installed.
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';
The text was updated successfully, but these errors were encountered: