Skip to content

React bridge breaks when used with React 16 versions earlier than 16.13.0 #3592

@CarltonHowell

Description

@CarltonHowell

Describe the bug

React bridge breaks when used with React 16 versions earlier than React 16.13.0. React 16.13.0 introduced the version prop (https://github.com/facebook/react/releases/tag/v16.13.0) which react-bridge uses in the isReact18 check:

const isReact18 = ReactDOM.version.startsWith("18");

When using React 16.12.0 this checks fails with:

Cannot read properties of undefined (reading 'startsWith')

Reproduction

https://github.com/CarltonHowell/react-16-17-bridge-demo

Used Package Manager

pnpm

System Info

System:
    OS: macOS 14.7.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.43 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.13.1 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
  Browsers:
    Chrome: 134.0.6998.89
    Safari: 18.3

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions