View on GitHub

reading-notes

Context API

Use reducer is just a more complex or a more compact use of useState, so instead of just updating one value at a time, you pass an action “type” inside an object, and using the switch from js, you choose which action to take.

 

So react knows that this method is a hood, and as such does some extra logic for it.

 

Whatever you want them to do, it really depends on your needs, as they are just normal JS function that you can hood to your react project.

 

use-custom-hooks install quite a few hooks, some of which are useQueue and useStacks which allow you to use stacks and queues easily.

 

It first gets called from a component, maybe even gets passed some data, afterwards it does anything it wants with the data, in this case calling an API, so it calls this API with any method or library that it’s written to use, and then does whatever it’s written to do with this data before passing it back (if desired) to the component.

 

Go back to table of contents