I like to think about hooks a bit like a Ski lift. This is this big set of events going around and around - in React this is made up of Fibers, which are basically a unit of work that React is going to do. Regardless of what you do, this thing is going to keep moving around in the background. Hooks let you grab on and ride the lift to the spot you need or look at the lift and do something when it reaches a certain point. This can happen in a number of different ways, with varying levels of interaction with the "lift" itself.

useState basically say "Hey, ski lift! Hold this object and when you do a unit of work, give it back to me!" useEffect is sort of like "I am watching this spot on the lift and when it does something interesting I am going to react!". useRef is kind of like attaching a box to one of the lift cars - and sometimes the lift changes what is in the box.

Hopefully that helps!

 

Here's how I figured out what it meant.
In a WordPress website, WordPress has these little snippets of code to generate the HTML.

For example:
[Generate Header]
[Generate Body]
[Generate Comment Box]

Let's say you wanted to put a social media banner between the Header and the Body. You would write the code, and then 'hook' into the body. So now, the stack is like this.

[Generate Header]
--> Your custom banner code
[Generate Body]
[Generate Comment Box]

 

hook into the rest of system.

Hook a Way to be in rhythm with the system.

 

Are you asking about callbacks or about React Hooks?

 
Classic DEV Post from Aug 9 '18

A medium sized read about large sized loneliness

A quick review of how difficult being without a community can be

Spouse and expecting father; general late bloomer