DEV Community

Cover image for What are React Hooks? 🎣

What are React Hooks? 🎣

Maxine on July 28, 2021

Table Of Contents Introduction What are Hooks? useState useEffect Rules of Hooks Building your own Hooks Additional Hooks and API Refer...
Collapse
 
majhar profile image
Amy S.

I always messed up with useState, and causing multiple render.
Happy Hooking!

Collapse
 
maxinejs profile image
Maxine

Bugs/Errors are sometimes our best teachers :)

Collapse
 
majhar profile image
Amy S.

Hi, do you use multer in your express project?

Thread Thread
 
maxinejs profile image
Maxine

You most certainly can, are you looking to do a file upload?

Thread Thread
 
maxinejs profile image
Maxine

Feel free to PM me, I would be happy to help you out if I can.

Thread Thread
 
majhar profile image
Amy S.

Yes, I'm working on a project and uploading users profile images, but now I'm confuse where should I save them. Should I save them on mongo as type of Buffer, or in the directory?

Thread Thread
 
maxinejs profile image
Maxine

I think using Buffers can get very confusing itself (so don't feel alone in that!), I can't say exactly since I don't know the extent of everything, but try this stackoverflow post. Here's also a post that goes into Buffers in Mongo DB. I hope that helps. (I personally think it may be easier to save to a directory, but I don't want to discourage you from using buffers in mongo since that could also be a really great learning experience and you are capable of doing either!)

Thread Thread
 
majhar profile image
Amy S.

Thank you so much!

Collapse
 
majhar profile image
Amy S.

Sure, it is!

Collapse
 
lexiebkm profile image
Alexander B.K.

You should mention about Hooks FAQ link (reactjs.org/docs/hooks-faq.html) in React doc, because it provides answer/solution to important questions about Hooks which are not covered in its main articles, such as :

  • Can I skip an effect on updates ?
  • Is it safe to omit functions from the list of dependencies ?
  • What can I do if my effect dependencies change too often ?
Collapse
 
zbretz profile image
Zach

This is dope. I'm a bootcamp student and am going to be looking at using hooks in my current project - but I don't know anything about them. I'm bookmarking this to read tomorrow.

Collapse
 
maxinejs profile image
Maxine

Thanks @zbretz ! I think that's really awesome you are already looking to use Hooks.

They're not scary I promise, plus there are tons of youtube tutorials you can watch to get a better grasp on them too.

Best of luck with your project, as well as your bootcamp :)