Reading Notes
What does a component’s lifecycle refer to? The time between mounting and unmounting a component.
Why do you sometimes need to “wrap” functions in useCallback
when called from within useEffect
? Prevents the recreation of a function
Why are functional components preferred over class components? Functional components are just standard JS functions.
What is wrong with the following code? Hooks should not be used inside of a loop?
useState(<initial state>)
used to create a state variableuseEffect
tells react to do something after the render is complete and after every updateuseEffect(()=>{document.title = 'You clicked ${count} times'});
use
, normal function but follows the rules of creating a Hookasync
keyword with useEffect
will create race condition(state, action)
and returns current state and a dispatch methoduse
useArray
provides access to many array methodsreact-use-form-state
quick way to setup formreact-fetch-hook
quick way to setup a fetch and provide isLoading stateuseMedia hook
tracks the state of CSS media queryreact-useportal
way to render children in to a DOM node that exists outside of the parents hierarchyreact-firebase-hooks
used for firebase authenticationuse-onClickOutside
way to know if a user clicks anywhere besides the targetuse-IntersectionObserver
provides a way to asynchronously observer changes in an intersection target of an element and ancestor elementuse-location
for getting the location of the browseruse-redux
hook returns the store and dispatch property