Monday, October 18, 2021
Topics ReactJS ReactJS v17 released - what's new

ReactJS v17 released – what’s new

This is a major release, and while you’d expect breaking changes, well, there aren’t any. And the same goes with any new features. There aren’t any! And this is a first.

v17 comes with a lot of updates under the hood, and you’d best do the update. You’d obtain speed and some other benefits just by updating, and optionally, progressively refactor code to match the new changes.

Here are some changes

Changes to event delegation

With this change in place, it is now quite safe to nest apps built with different versions of React, although this will start from version 17 and above.

Effect Cleanup Timing

This change only affects the useEffect() hook since useLayoutEffect() will keep its synchronous execution.

Changes to align with browsers

They have made a couple of changes related to the event system:

  • React onFocus and onBlur events have switched to using the native focusin and focusout events under the hood, which more closely match React’s existing behavior and sometimes provide extra information.
  • Capture phase events (e.g. onClickCapture) now use real browser capture phase listeners.

Removing Private Exports

A migration to a new method has already been completed that does not rely on these private exports.

No Event Pooling

The old design of event pooling has been eliminated entirely.

Consistent Errors for Returning Undefined

In React 16 and earlier, returning undefined has always been an error:

In React 17, the behavior for forwardRef and memo components is consistent with regular function and class components. Returning undefined from them is an error.

For the cases where you want to render nothing intentionally, return null instead.

Native Component Stacks

In React 17, the component stacks are generated using a different mechanism that stitches them together from the regular native JavaScript stacks. This lets you get the fully symbolicated React component stack traces in a production environment.

React 17 enables gradual React upgrades. 

When you upgrade from React 15 to 16 (or, soon, from React 16 to 17), you would usually upgrade your whole app at once. This works well for many apps. But it can get increasingly challenging if the codebase was written more than a few years ago and isn’t actively maintained. And while it’s possible to use two versions of React on the page, until React 17 this has been fragile and caused problems with events.

See full list of changes

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest news

2 great tips to get hired faster

If it's time to change job and would like to do it faster, we have two useful tips for...

EpicReact.Dev – Well polished advanced ReactJS Training

There are countless tutorials that cover the basics of ReactJS. A lot of them are very well made, with...

Becoming a Front-end developer in 2021

In the past few years, we've been hearing more and more about learning fatigue for front-end development. And it...

Algorithms are more common in Interviews

The tech interviews for developers have shifted a lot in the past 15-20 years. In the early 2000, a...

More on React Server Components

Will React Server Side components change how we build React Applications?What does this mean for libraries such as NextJS? Recently,...

Top 5 ReactJS Podcasts with fresh content

There are different platforms and different sources of information to get up-to-date content on the ever growing topic of...

Must read

2 great tips to get hired faster

If it's time to change job and would like...

EpicReact.Dev – Well polished advanced ReactJS Training

There are countless tutorials that cover the basics of...

You might also likeRELATED
Recommended to you