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

Research what changes are needed in Wave to support React 18 #212

Closed
nlopin opened this issue Apr 7, 2022 · 5 comments
Closed

Research what changes are needed in Wave to support React 18 #212

nlopin opened this issue Apr 7, 2022 · 5 comments
Labels
dependencies Pull requests that update a dependency file

Comments

@nlopin
Copy link
Contributor

nlopin commented Apr 7, 2022

React@18 has just come up. Our package.json implicitly allows us to use it with Wave. We need to verify it is the case and create a migration task in case an additional effort is needed.

@nlopin nlopin added the dependencies Pull requests that update a dependency file label Apr 7, 2022
@JanHamara
Copy link
Contributor

Linking upgrade guide: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html

GIST and main takeouts:

May be relevant

Other

  • Revamp of react-dom/server: Old Node streaming API and renderToNodeStream are deprecated. New APIs that support streaming SSR with Suspense (renderToPipeableStream, renderToReadableStream)
  • useSyncExternalStore is a new hook that allows external stores to support concurrent reads by forcing updates to the store to be synchronous.
  • completely dropping support for Internet Explorer 🥳
  • Components can now render undefined

Deprecations

@nlopin
Copy link
Contributor Author

nlopin commented Apr 8, 2022

useId is something we need to migrate to, because we're currently generating ids using an external library and it doesn't work well with SSR

@vitalybaev
Copy link
Contributor

One more thing to do is to update components type declarations that use React.FC because in @types/react@18x FC can't have children by default:

interface FunctionComponent<P = {}> {
-  (props: PropsWithChildren<P>, context?: any): ReactElement<any, any> | null;
+  (props: P, context?: any): ReactElement<any, any> | null;
   propTypes?: WeakValidationMap<P> | undefined;
   contextTypes?: ValidationMap<any> | undefined;
   defaultProps?: Partial<P> | undefined;
   displayName?: string | undefined;
}

PropsWithChildren now isn't used anywhere, just exported. We have to replace React.FC<Props> with React.FC<PropsWithChildren<Props>>.

@nlopin
Copy link
Contributor Author

nlopin commented Jun 3, 2022

I think for the current major we can just allow using Wave with react@18 without any changes (only in package.json)

For the next major we should start using the new React@18 concurrent engine in order to utilize new hooks. For example, we can remove nanoid because react@18 has useId hook with the same functionality

@martimalek
Copy link
Contributor

Since this issue was meant to be a research to see if we can support or not React 18 and we already support it in Wave 2.0 I am closing it, any other enhancements related to React 18 can be in the form of new issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Development

No branches or pull requests

4 participants