Skip to content

Server-side validation and module dependencyΒ #440

@omeralpi

Description

@omeralpi

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.

As an alternative, it would be much better if there were a usage like this for server-side validations within Next.js server actions.

import { isValidPhoneNumber } from 'react-phone-number-input/libphonenumber';

or

import { isValidPhoneNumber } from 'react-phone-number-input/libphonenumber';
import { isValidPhoneNumber } from 'react-phone-number-input/core/libphonenumber';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions