-
Notifications
You must be signed in to change notification settings - Fork 558
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
RFC: Intent to ship React 18 #212
Conversation
This RFC describes the changes we intend to ship in React 18.
So since i'm not seeing any info about native support for web components in the RFC, does that mean that web component native support wont ship in React 18? If so, is there a rationale for that decision? |
Re: #212 (comment)
It's available in the |
If a library wants to support React 16/17/18 is there a recommended way of providing a import { useId } from 'react';
const useMyId = () => useId ? useId() : useState(uuid()); |
Re: #212 (comment)
There are libraries that do this pre-18, such as |
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
It looks like the Strict mode change is for the Offscreen API, will the Offscreen API be released in React 18? |
Re: #212 (comment)
Not in 18.0 but it’s one of the things we’ll be focusing on after 18.0 is out. So it will be out likely in some 18.x release if everything goes well. |
Sorry if this is addressed and I failed to find it, but is there a part of the RFC that expands on |
I really liked the |
You can use the From Automatic batching for fewer renders in React 18 write-up:
|
Re: #212 (comment)
No, this is an accidental omission. We'll try to write up something soon. The quick tldr is that |
Re: #212 (comment)
No, you can't configure it. As @Moshyfawn described in #212 (comment) though, you can opt out of it for a specific |
Is there any way to get the benefits of the server integration without a node.js backend? I guess the applies to traditional SSR but is there a wire protocol spec (not sure if this is just a matter of a JSON schema or something more)? If not I think it would be great if there was. Then there could be backends in other languages that support "isomorphic apps." For instance I develop in Scala, using Scala.js to compile the frontend and scalajs-react to build React UIs. But right now the only way I know of to get SSR in Scala involves a complicated setup. If the new server features, as well as traditional SSR, would have a wire spec then alternative backends could be written in other languages. |
Re: #212 (comment) The main value proposition of both SSR and Server Components is that you get to run the same own component code on the backend. In principle, nothing stops you from emulating the payload React generates (e.g. by running Scala versions of your components and reimplementing the React server renderer), but there are no current plans to standardize the payload. |
If it was, the Scala vdom DSL could easily be implemented in a way that it would do different things on the JVM backend vs. the JS frontend. So this benefit could still be achieved with a much simpler setup if only the payload was specified. |
We don't specify the exact payload protocol because there is a lot of benefit to being able to change it midway without bumping versions. So I don't see that happening. In practice, the HTML output we produce is relatively stable and usually matches what you'd expect, aside from a few special instructions (like for Suspense). The most pragmatic solution, if you really wanted to do something like this, is to take our test suite and run your implementation against it. Since you're probably going to want to recreate other behaviors (like actual rendering of components according to React rules!) too. So if you're running against our test suite, you can consider that to be the specification. Then as long as you use the same version of React as the version that the tests were written against, it should work well. Tests are the source of truth for us, too. |
We've added reactwg/react-18#129 with an explanation of |
Update: I've added |
Also included here are all the docs we are adding and changing on the website: reactjs/react.dev#4499. For a preview, see: https://18-preview.reactjs.org. |
Is there a pattern or plans for adding |
Re: #212 (comment)
There is no way to get a behavior where we first "wait" and then show the fallback after a timeout. We used to provide that ability but removed it. We found that in practice there's no concrete meaningful number one can specify (one second? three seconds? ten? how to choose?) and it ends up being a confusing user experience (the switch to fallback implies some kind of a change but there was no actual change). We think the current heuristic with consistent behavior for "new" vs "existing" boundaries works better in practice. |
This RFC describes the changes we intend to ship in React 18 🎉
View formatted RFC