fix(ui-components): react in regular dependencies causes duplicate hook errors in consumer apps · Issue #9175 · nodejs/nodejs.org · GitHub
Skip to content

fix(ui-components): react in regular dependencies causes duplicate hook errors in consumer apps #9175

Open

Description

@alexicum

Description

Currently, react is listed under dependencies in packages/ui-components/package.json.

While it works fine inside the monorepo, it breaks consumer apps that use a different sub-version of React 19. Package managers install a duplicate copy of React , leading to the runtime error:

Invalid hook call. You might have more than one copy of React in the same app.

Proposed Solution

Move react from dependencies to peerDependencies (and duplicate in devDependencies for local workspace builds).

We should use a named pnpm catalog (catalog:peer-react19 with a ^19.0.0 range) so the published package accepts any React 19 version installed by the consumer app.

Activity

  1. alexicum commented on Oct 16, 2026

    @alexicum
    ContributorAuthor

    Thanks to @avivkeller and @MattIPv4 for attention to PR!
    We have discussed that catalog:peer-react19 is redundant.

    I added it to the future, if, for example, there would be another package with react dependency - it would be good to have peer-react.
    Not sure, but @node-core/platform-vercel is candidate, because it has peer react:

      "peerDependencies": {
        "next": "catalog:",
        "react": "catalog:"
      },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions