n8design/htwoo

React Versions.

Closed this issue · 5 comments

I tried using this project as a non-spfx/teams project, since Fluent UI works on SPFx/Teams/Websites. It failed for me because the dependencies are 16.X. And downgrading my project just doesn't seem worth it since React 16 is so old.

I would like the React/React-DOM dependencies to be peer dependencies as shown:

{
    "peerDependencies": {
        "react": ">=16.14.0 <=17.0.2",
        "react-dom": ">=16.11.0 <=17.0.2"
        ....
    }
}

Additional context
React 16 & React 17 may be 2 different major versions, but React 17 should not be a breaking change for most projects. The difference is how event handlers occur within React. 16 used "document" level events, while React 17 uses scoped level events.

I checked the Dist folder/compiled output of the React package and it doesn't bundle React, which gives me confidence that switching to peer-dependencies is a non-breaking change for this project. It might cause TSC to fail, and to work around that would be @types/react and @types/react-dom.

Having the project be compatible with React 18 would be hard and requires time/effort, but it should be possible to cater for >=16.14 <=18.2

Any feedback would be greatly appreciated.

@abjfdi - This is great feedback thank you. I admit that the bulk of my time is spent using Microsoft SharePoint framework which is pinned to v16 and I haven't spent a ton of time figuring out the dependencies for how far into future versions I can go before it becomes a problem so you're feedback is much appreciated. I can easily do at least what you've requested and then spend some time figuring out where in 18 things go horribly wrong... Does that sound like a good first step? I'll be releasing 1.2 later today.

Small update to my previous statement, after checking versions, to make sure I retain compatibility with SPFx >=v1.13 I need to support React v>=16.13.1, so for this release I'll change the peerDependencies to

   "peerDependencies": {
        "react": ">=16.13.1 <=17.0.2",
        "react-dom": ">=16.11.0 <=17.0.2"
        ....
    }

This sounds perfect thanks, if there is no issues in the project with this change. You can close the isuse.

Also just to note, you can have the peerDependencies be from 16 to 17. That would support more version 1.7.0+ of the SPFx framework.

"peerDependencies": {
        "react": ">=16 <=17",
        "react-dom": ">=16 <=17"
        ....
}

Good point I wasn't thinking of it that way.. thanks.

Released with 1.2.0 of HTWOO-React