open-feature/js-sdk

Request to Address Compatibility Issues with React

Closed this issue · 4 comments

Observed behavior

The current version of the react-sdk relies on a React version >=18.0.0. However, there are compatibility concerns for applications that might be using older versions of React, potentially causing dependency warnings or errors. Since hooks were introduced in react 16.8.0 so we should be putting the minimum version to 16.8.0

Expected Behavior

The package should maintain compatibility with applications using older versions of React while also supporting the latest versions without compromising functionality.

Steps to reproduce

  1. create a react project using react 16.8.0, node 14, npm 6.X.X
  2. install @openfeature/react-sdk

Observe the following warning:

npm WARN @openfeature/react-sdk@0.0.5-experimental requires a peer of react@>=18.0.0 but none is installed. You must install peer dependencies yourself.

Hey @shujieali, I've assigned this issue to @toddbaert. He was working on adding support for the React suspense API which relies on some changes added in React 18 I believe. However, I understand that people may not but using that version of React yet. Perhaps there's a way to add support for suspense without making it incompatible with React 16.8.

@beeme1mr Thank you ! React suspense is indeed an amazing addition, but we should be careful in defining minimum requirements for a package. i'll have a look on the suspense implementation and see what can be done !

That would be great!

@shujieali relevant comment: #742 (comment).

It might be that the suspense features we have work fine with 16.8.0. I just want to test them. If they do work fine, or there's only minor changes or differences in behavior, I'm fine with this change. I'll confirm next week.