DEV Community

Cover image for Can I Use React Hooks Yet?

Can I Use React Hooks Yet?

Eric Bishard on January 23, 2019

Update: On February 06, 2019, React 16.8 introduced Hooks as a stable feature! The short answer is... Yes. When I originally wrote this article we...
Collapse
 
stereobooster profile image
stereobooster
Collapse
 
httpjunkie profile image
Eric Bishard

Let's make sure nobody misunderstands this PR, this is merely a preparation to turn hooks on inside React, but you still cannot use them right now inside an application without installing the alpha version, which many are actually using in production (so I have heard). I think what this PR shows is that .. Shit's ready to go and the next release should have them turned on, this is a big deal because the last release that shipped 16.7, was suppose to have Hooks and it did not, so this is just a way of them hinting that it's now ready and the next release will be game on!

Collapse
 
dexygen profile image
George Jempty • Edited

Hooks, schmooks....there will be another best practice coming down the pike in mere months, I'm sure. Maybe this (just kidding, it's my own hack): github.com/dexygen/withMethods

Collapse
 
httpjunkie profile image
Eric Bishard

I don't agree about another way that at least is supported by the core team, however; I do like your method registry idea. I think it is healthy to say: "How would I do this differently" as well as go even further and try to flesh out an example and share it with the community. I commend you for asking questions and presenting alternatives.

The reason I don't think anything else will come that will replace it is that something like useState and useEffect are abstractions over already existing things like setState and lifecycle hooks which in order to provide for us the team has to make these work under the hood and it took a lot off time. We can think back to React Fiber as the start of a lot of this work IMHO. Would love to hear more of your ideas though. I'm new to React, but I'm learning more and more each day!

Collapse
 
httpjunkie profile image
Eric Bishard

This comment aged well, jk...

Collapse
 
edetscript profile image
Abednego Edet

Yes you can :)

Collapse
 
jvarness profile image
Jake Varness

The hooks boy-o, the hooks!!!