They kept us in Suspense long enough, but HECK React developers have some new features to play with!! The best part: Almost all of the benefits of the

React 18 Alpha is out! Now what?

submited by
Style Pass
2021-06-08 20:00:05

They kept us in Suspense long enough, but HECK React developers have some new features to play with!! The best part: Almost all of the benefits of the upgrade don’t require major code changes.

React has always had to have some kind of root. You’re probably used to seeing something like this at the top level of your applications:

Pretty normal, right? Right. This ReactDOM.render() is now called the Legacy Root API. It works the exact same way as React 17. You are still allowed to keep this, but it will be eventually deprecated.

With this change, a few things happen: - The hydrate method is gone, and is now an option on createRoot - The render callback is gone (and can now be a prop passed in to <App /> or whatever you give to the root)

If you don’t use these two functions, then you don’t have to worry about their changes. If you’d like more details on them, there’s some code change examples here from the React core team.

Leave a Comment