def install_frontend_packages(packages: set[str], config: Config):
    """Installs the base and custom frontend packages.

    Args:
        packages: A list of package names to be installed.
        config: The config object.

    Example:
        >>> install_frontend_packages(["react", "react-dom"], get_config())
    """
    install_package_managers = get_nodejs_compatible_package_managers(
        raise_on_none=True
    )

    env = (
        {
            "NODE_TLS_REJECT_UNAUTHORIZED": "0",
        }
        if environment.SSL_NO_VERIFY.get()
        else {}
    )

    primary_package_manager = install_package_managers[0]
    fallbacks = install_package_managers[1:]

    run_package_manager = functools.partial(
        processes.run_process_with_fallbacks,
        fallbacks=fallbacks,
        analytics_enabled=True,
        cwd=get_web_dir(),
        shell=constants.IS_WINDOWS,
        env=env,
    )

    run_package_manager(
        [primary_package_manager, "install", "--legacy-peer-deps"],
        show_status_message="Installing base frontend packages",
    )

    development_deps: set[str] = set()
    for plugin in config.plugins:
        development_deps.update(plugin.get_frontend_development_dependencies())
        packages.update(plugin.get_frontend_dependencies())

    if development_deps:
        run_package_manager(
            [
                primary_package_manager,
                "add",
                "--legacy-peer-deps",
                "-d",
                *development_deps,
            ],
            show_status_message="Installing frontend development dependencies",
        )

    # Install custom packages defined in frontend_packages
    if packages:
        run_package_manager(
            [primary_package_manager, "add", "--legacy-peer-deps", *packages],
            show_status_message="Installing frontend packages from config and components",
        )
Installs the base and custom frontend packages.

    Args:
        packages: A list of package names to be installed.
        config: The config object.

    Example:
        >>> install_frontend_packages(["react", "react-dom"], get_config())
    
reflex/utils/prerequisites.py