DEV Community

Cover image for Making Sense of React Hooks

Making Sense of React Hooks

Dan Abramov on November 02, 2018

Originally published on Medium This week, Sophie Alpert and I presented the “Hooks” proposal at React Conf, followed by a deep dive from Ryan Flor...
Collapse
 
andy profile image
Andy Zhao (he/him)

If the React community embraces the Hooks proposal, it will reduce the number of concepts you need to juggle when writing React applications.

As a fairly recent React user, I think this is probably the biggest selling point for me. Have a good feeling that Hooks will make things easier to use and understand, as opposed to adding more complexity.

Collapse
 
kayis profile image
K • Edited

This will only ease the pain for new developers that start new projects.

If you start with React and have to work with existing projects, depending on its age, you'll have to wrestle all concepts (Mixins, Higher Oder Components, Render Props).

Collapse
 
ben profile image
Ben Halpern

Yes. But at least with existing codebases, you can sort of pattern match and learn by a bit of trial and error. Too many competing concepts is probably harder when you're green field and the task at hand is still super abstract.

Collapse
 
dan_abramov profile image
Dan Abramov

Yeah. We’re optimizing for long term.

Thread Thread
 
kayis profile image
K

Never questioned it :)

Collapse
 
roseanna profile image
Roseanna Mcfarlane

I just wanted to say thanks for all the hard work you do (along with many others such as Sophie) to keep the community updated re React. I follow ya'll on Twitter and don't think I've seen any two people so passionate about keeping people informed and in the loop :)

I just wanted to say that randomly.

Collapse
 
dan_abramov profile image
Dan Abramov

Thank you!

Collapse
 
lop900 profile image
lop900

Osm! This post is very informative and effective. I got what I was looking for. Here to say thank you. Thanks for sharing FMWhatsapp valuable content.

Collapse
 
johnseddy profile image
Johnseddy

We have a similar thought and I also might like to mention about this informational post in my gaming website at mini militia for pc download to engage more users here.

Collapse
 
tunisblizz profile image
Adedapo Olatunde

Yeah. I also want to thank you for YouTube to mp3 conversion too.

Collapse
 
thomasjunkos profile image
Thomas Junkツ

At the risk of being offtopic, I want to say a big thank you to you, Dan, for your time and effort of posting here :]

Collapse
 
sergio profile image
deleteme deleteme

This feels like redux ideas being shoehorned into React. The code itself looks so ugly to me and overly ceremonious. React lost something BIG today and prompted me to look into VueJS as the boring straightforward choice.

Collapse
 
dan_abramov profile image
Dan Abramov

What code examples are you comparing? I don’t see any similarity to Redux in this article but maybe I’m missing something. If anything code using Hooks looks less ceremonious to me than either of the alternatives (like render props or HOCs).

Please elaborate with examples?

Collapse
 
felixbores profile image
Felix Manuel Bores Hevia

I totally disagree my friend. You have to look to Hooks as something that has been 'added', rather than 'changed'. You can keep doing things in React the same way before Hooks came into play, and that, from my point of view, is one of the best accomplishment of the React Team. But dude, Hooks are awesome anyways! :)

Collapse
 
theoutlander profile image
Nick Karnik

That’s an interesting perspective. What parts of it look ugly specifically? This is also optional for now as you can continue working with react without using hooks.

Collapse
 
xni profile image
Konstantin • Edited

Hi, Dan! Thank you for all you and the team are doing for the community!

If you have a couple of spare moments, I had a couple of ideas, maybe you can find then anyhow interesting.

1) You are saying that functions are stateless but in ES6 we have a function* or async function. They can be used as the event generators I suppose. Something like

const eventGenerator = ...;
while (true) {
   await eventGenerator();
   render();
   eventGenerator = ...;
}

Have you considered that option?

2) Just a fun thing: Logo of the city where I was born is an atom - why not to do the next React conf there? ;)

3) This is the example from the React Documentation

useEffect(() => {
    // Update the document title using the browser API
    document.title = `You clicked ${count} times`;
  });

I think it is pretty confusing, there is no reason why this particular example cannot be rewritten as

document.title = `You clicked ${count} times`;
Collapse
 
xni profile image
Konstantin

UPD. Actually found the answer to my third question in the React API Reference.

Collapse
 
meetnawazish profile image
Fashion Clothes

Yes, this is truly working techniques and I really appreciate your efforts on research on react hooks. I would also apply these techniques on gbwhatsapp.net/whatsapp-plus-apk/ for best experience

Collapse
 
elizabethsawan profile image
elizabeth sawan

To share this techniques I think you can use this gbinstaa.com/instagram-plus-apk/ to optimize posts and media.

Collapse
 
anthgrim profile image
Anthony Grimaldi

I've been learning React for over two months, at first it was pretty difficult to me to understand the whole logic behind it, but I got used to it fairly fast. I didn't really like hooks at first, but while doing some exercises here and there with and without them I realize how easy and important hooks become when developing a more interactive app.

Collapse
 
ko15971662 profile image
ko

Hooks although still in development, we are very hopeful, you can also pay attention to FM WhatsAPP GBWhatsAPP FouadWhatsAPP YOWhatsAPP version update and function update use, WhatsApp is a great social app.FouadWhatsAPP

Collapse
 
elisonparker5 profile image
Elison Parker

There has been a lot of pressure, but the actual apps have survived and they are giving best results along with user experience. (bestchainsaws.com.au/best-chainsaw...) This is going to be great.

Thanks for providing such an Amazing information's!

Collapse
 
elisonparker5 profile image
Elison Parker

This is actually the best information that I have seen today! If you want GB WhatsApp other then you can download free on gbwhatsapp.net. They are one of the best fastest WhatsApp apk online. mygbapps.com/ for best Experience.

Collapse
 
alekawa profile image
alekawa

Thank you for this article, very insightful! The topic of React Hooks was also mentioned at the most recent React Conference in Berlin.
You can read a recap of it (also including Hooks) here: selleo.com/blog/react-day-berlin-2...

Collapse
 
peter profile image
Peter Kim Frank

Hey Dan, thanks so much for this. It's been very interesting reading and watching the articles on the subject be posted over the past week or so.

As you mentioned:

Note: Hooks are an experimental proposal to React.

Do you think that people actually heed that warning? How do you suggest folks find the right balance between jumping right in to learn and experiment vs. proceeding with sufficient caution?

Collapse
 
rimi887 profile image
rimi887

Great post I have ever seen well explained article thanks for sharing, it's really helpful for me and other as well. Same well to understand post I have also seen on the YouTubeVnaced.org

Collapse
 
akshaytom profile image
Akshaytom

BGMI APK 2.6 Download latest version here, download bgmi apk + obb File for your Android Smartphone and Enjoy the Indian PUBG BGMI 2.1 apk Game.

bgmiapkupdate.in/
capcutmodsapk.in/

Collapse
 
mike70 profile image
Mike

Great information! You can also check out the fm whatsapp app for Android phones.

Collapse
 
anawats07540454 profile image
Ana Watson

I am very impressed with your post, thanks for sharing. Would love to see more stuff like this in future. clashmod.net/dream-league-soccer/

Collapse
 
tamouse profile image
Tamara Temple

yes, my first reaction was rather visceral, i cried tears of joy. This is going to be great.

Collapse
 
tifflabs profile image
tiff

I am super excited by Hooks. I don't know if I will miss the explicitness of React but I doubt it. A little magical but some magic is alright I suppose. ;)

Collapse
 
aroic_x profile image
AroicX • Edited

Hey please i have some issues with react hooks and storing state and update state from localstorage

Collapse
 
marygw profile image
Miya William

Hooks will leave a great turning point for many users.

Collapse
 
apk_arabic profile image
apk arabic

I am very impressed with your post, thanks for sharing. Would love to see more stuff like this in future.