Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the documentation correct regarding React version compatibility? #924

Open
marlonpatrick opened this issue Sep 24, 2022 · 4 comments
Open

Comments

@marlonpatrick
Copy link

This page of preact documentation informs you that:

Thus, the website and documentation reflect React 16.x and 15.x when discussing compatibility or making comparisons.

But, I noticed that the 10.11.0 release apparently already provides support for React 18.

In this case, is the information in the documentation correct or is it outdated? The correct version compatibility would be React 18.x and 17.x?

@marvinhagemeister
Copy link
Member

A bit of both. We should update it, but with React 18.x it isn't as clear cut anymore as we I disagree with the directions they are taking. We don't think adding concurrent mode is a good idea and therefore it's unlikely that we'll invest time into that. Some other stuff like the batching of state update is something we've always had in Preact since the beginning and we're glad that React adopted that mentality too.

This makes it a bit harder to narrow it down to a single version number for compatibility support. Maybe we need sort of a feature matrix table or something like that.

@marvinhagemeister marvinhagemeister transferred this issue from preactjs/preact Sep 25, 2022
@marlonpatrick
Copy link
Author

Maybe we need sort of a feature matrix table or something like that.

This would be great as preact is often considered for projects that already use React.

@marlonpatrick
Copy link
Author

We don't think adding concurrent mode is a good idea and therefore it's unlikely that we'll invest time into that.

Could you explain possible consequences of this? In the future, could this make a React 18 code not buildable when replacing with preact? Or would it be buildable but the features would just be placeholders?

From what I've seen in the doc, Suspend and lazy are experimental in preact. Do you still intend to invest in these features? What about React.startTransition and React.useTransition, does it work or will work in preact?

I'm considering using preact in a new project that will be used as a webview, so the performance gain makes perfect sense for this use case. However, my company uses React in 100% of the web projects, so this compatibility issue is also quite important to me.

Do you have an idea of which path preact should take in its evolution to Preact 11? Will React compatibility still be an important goal?

@rschristian
Copy link
Member

Could you explain possible consequences of this?

The consequences are that anyone looking to fully embrace React's concurrent features will not find full support. Preact will instead promote and encourage other paths/solutions, as we already do.

What this means in more concrete terms, only time will tell. We don't yet know where React is going, the API mechanisms it will use, or how the ecosystem will react to and embrace these changes.

In the future, could this make a React 18 code not buildable when replacing with preact?

I don't think there will be further major changes in React 18, but beyond that, it's probably unlikely that there are parts of the API we cannot offer in any form such that it's impossible to build projects which use those API features.

Unbuildable projects when using preact/compat is worst-case scenario, so it'll be avoided if at all possible.

What about React.startTransition and React.useTransition, does it work or will work in preact?

Those are concurrent mode features and are stubbed out in preact/compat.

https://github.com/preactjs/preact/blob/a868b0280a73f28efc49862b75ccd24624cd5f21/compat/src/index.js#L121-L131

As Marvin said, it's unlikely they'll be invested in past this representation.

Will React compatibility still be an important goal?

It is, but Preact has never been 100% compatible with React. With concurrent features the React team has taken a step in a direction that we think existing solutions already solve in better ways. It's not a compelling feature set to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants