days
0
2
hours
0
5
minutes
1
2
seconds
4
9
The hype is real

React v16.8 arrives with Hooks available in a stable release

Eirini-Eleni Papadopoulou
React
© Shutterstock / Groundback Atelier  

The wait is over! React v16.8 is here and it brings Hooks in a stable release! If you missed the hype and you don’t know what we’re talking about, fear not! In this article, we are having a closer look at this new feature.

React v16.8 is live and so is the stable release of Hooks!

This new release brings a couple of important updates and improvements, but the Hooks is definitely the feature that steals the spotlight!

Before we dig deeper into this new feature, let’s have a quick look at the other updates in React v16.8.

React DOM:

  • Bail out of rendering on identical values for useState and useReducer Hooks. (@acdlite in #14569)
  • Don’t compare the first argument passed to useEffect/useMemo/useCallback Hooks. (@acdlite in #14594)
  • Use Object.is algorithm for comparing useState and useReducer values. (@Jessidhia in #14752)
  • Support synchronous thenables passed to React.lazy(). (@gaearon in #14626)
  • Render components with Hooks twice in Strict Mode (DEV-only) to match class behavior. (@gaearon in #14654)
  • Warn about mismatching Hook order in development. (@threepointone in #14585 and @acdlite in #14591)
  • Effect clean-up functions must return either undefined or a function. All other values, including null, are not allowed. @acdlite in #14119

Check out the official changelog for the extensive list of updates.

And now, all aboard the Hooks hype train!

Don’t let me off the Hook, please!

First of all, what exactly are Hooks?

React Hooks a new feature that lets you use state and other React features without writing a class and it’s React solution to with issues like giant components and confusing classes that, as Sophie Alpert has mentioned, are confusing both for humans and machines!

But what is so special about Hooks, anyway?

Hooks let you organize the logic *inside* a component into reusable isolated units by applying the React philosophy, explicit data flow and composition, inside a component, rather than just between the components.

Although the concept is very interesting and it definitely has the potential to reduce the number of concepts you need to maneuver around when writing React applications, it is totally understandable that some of you may have some concerns about the new features. So, let me address some of your skepticism.

First of all, the introduction of Hooks does not mean that classes are getting replaced! In fact, Hooks work side-by-side with the existing code so you can adopt them gradually if you wish to. Have a look here to find out more about React’s gradual adoption strategy.

Hooks are also 100% backward-compatible since they don’t contain any breaking changes.

Now, if you cannot wait to start using Hooks, head over to the official overview and learn all you need to know about this new feature!

Author
Eirini-Eleni Papadopoulou
Eirini-Eleni Papadopoulou is an assistant editor for JAXenter.com. Just finished her masters in Modern East Asian Studies and plans to continue with her old hobby that is computer science.

Leave a Reply

Your email address will not be published.