Advanced State with Reducers
Review, Research, and Discussion
-
How can we ensure that an effect hook runs only once?
- adding an empty
[]after the callback function in useEffect()
- adding an empty
-
Can useState() update more than one state variable at the same time?
- no, useState() should update one state variable at a time
-
Is useState() synchronous?
- no, it is asynchronous. It does not update the state immediately but have queues that are used to update the state object
Document the following Vocabulary Terms
-
State Hook: special function that lets you “hook into” React features
-
Component Lifecycle: there are four parts of a component’s lifecycle, initialization, mounting, updating, and unmounting