growthmindsit

useState() Hook

Review, Research, and Discussion

Document the following Vocabulary Terms

Preparation Materials

What is a Hook? are functions that let you “hook into” React state and lifecycle features from function components. For example, useState is a Hook that lets you add React state to function components

React provides a few built-in Hooks like useState. You can also create your own Hooks to reuse stateful behavior between different components.

The Effect Hook, useEffect, adds the ability to perform side effects from a function component. It serves the same purpose as componentDidMount, componentDidUpdate, and componentWillUnmount in React classes,

When you call useEffect, you’re telling React to run your “effect” function after flushing changes to the DOM. Effects are declared inside the component so they have access to its props and state. By default, React runs the effects after every render — including the first render.

Declaring a State Variable: by call the useState Hook directly inside our component

useState returns a pair: the current state value and a function that lets you update it

✌ Rules of Hook

making sense of hooks

the state hook

hooks api hooks api reference

Github view