Reading-Notes

Class 31 Summary:

Context API

Describe use cases useState() vs useReducer() ?

Why do custom hooks need the use prefix?

What do custom hooks usually do?

Using any list of custom hooks, research and name one that you think will be useful in your applications?

  1. “useScript React hook to dynamically load an external script and know when its loaded ,useScript is a hook for loading (and notifying when they’re loaded) external scripts, dynamically”.

  2. use-mouse-action :”A library with three React hooks for listening to mouse events on an element or JSX element. useMouseAction: This is used to register mouse actions on an element. useMouseDown: This is used to register a mouse down event on an element. useMouseUp: This registers a mouse up event on an element”.

Describe how a hook that fetches API data might work?

Document the following Vocabulary Terms :

Term  
reducer Reducers in NgRx are responsible for handling transitions from one state to the next state in your application. Reducer functions handle these transitions by determining which actions to handle based on the action’s type

Context :

When to Use Context :

image1

Before You Use Context :

React.createContext :

Context.Provider:

Class.contextType :

Context.Consumer :

Caveats:

An Exercise in Hooks and Context:

Sources:

source1 source2 source3 source4 source5