maslianok / react-resize-detector

A Cross-Browser, Event-based, Element Resize Detection for React
http://maslianok.github.io/react-resize-detector/
MIT License
1.25k stars 91 forks source link

Incorrect peer dependencies #253

Closed shannonhochkins closed 6 months ago

shannonhochkins commented 6 months ago

Just wondering why the package is expecting users to install react 18 for this? Yes, there's performance updates with 18 vs 16, but I have a monolithic application that we simply cannot update to 18 (yet)

  "peerDependencies": {
    "react": "^18.0.0",
    "react-dom": "^18.0.0"
  },

Wondering if you can change the peer dependencies to 16 as there's nothing in this hook that should indicate it requires 18, this would help us so we don't get warnings when installing

snelsi commented 6 months ago

React versions before 18 are considered legacy at this point. Compatibility with them is not guaranteed. We dropped support for previous versions of React to provide long-term stability and maintenance for react-resize-detector v10.

You can stay on the latest react-resize-detector v9 release until you can migrate your application to React 18:

npm i react-resize-detector@9.1.1
shannonhochkins commented 6 months ago

You can always drop ongoing support without raising the peer dependency requirements? As mentioned, that isn't how you manage support, simply mention it rather than enforce it

snelsi commented 6 months ago

Updating peer dependencies is a breaking change and requires a major version bump. react-resize-detector v10 only guarantees support with React v18+. If you need support for React 16 you can either ignore the recommended peerDependencies or downgrade to react-resize-detector v9.1.1

shannonhochkins commented 6 months ago

How is it a breaking change? curious why you're saying that? Peer dependencies are determined or installed by npm or manually with yarn, don't understand why you say it's a breaking change?

snelsi commented 6 months ago

react-resize-detector v10 has been developed and tested with React 18, and therefore, it's reasonable for the package to set React 18+ as a peer dependency. Users who need compatibility with React 16 can either choose to ignore the recommended peerDependencies or stick with the previous version of the package (v9.1.1), which is compatible with React 16.

shannonhochkins commented 6 months ago

That doesn't answer my question about it being a breaking change, and you do keep repeating yourself, I understand that you've said it works with 18 and it's tested with 18, as i said in my first request, there's absolutely nothing in the code that suggests that it should be fixed to 18, you're excluding an entire user base who are stuck with older versions of react, i would normally agree with you if this was a complicated intricate piece of software, but it's not, it's a very simple hook using vanilla javascript features wrapped in a hook....