View on GitHub

401-reading-notes

CLASS 32

Custom Hooks

REVIEW, RESEARCH AND DISCUSS

What does a component’s lifecycle refer to?

Why do you sometimes need to “wrap” functions in useCallback when called from within useEffect

Why are functional components preferred over class components?

TERMS:

state hook

or useState() allows you to use state and other React features without writing a class. Hooks are the functions which “hook into” React state and lifecycle features from function components.

effect hook

or useEffect() tells your component needs to do something after render. React will remember the function you passed, and call it later after performing the DOM updates.

reducer hook

or useReducer() is usually preferable to useState when you have complex state logic that involves multiple sub-values or when the next state depends on the previous one.

React Docs