An open API service indexing awesome lists of open source software.

https://github.com/joaopaulopmedeiros/learning-react-hooks

Repository for learning React Hooks
https://github.com/joaopaulopmedeiros/learning-react-hooks

hooks-api-react reactjs

Last synced: about 1 month ago
JSON representation

Repository for learning React Hooks

Awesome Lists containing this project

README

          

# learning-react-hooks

## What is a Hook?
> A Hook is a special function that allows you to use React resources. For example, useState is a Hook
> that allows you to add the React state to a function component. We will learn other Hooks later. - ReactJS documentation

## When should I use a Hook?
> If you write a function component and realize that you need to add some state to it, previously you
> had to convert it to a class. You can now use a Hook within an existing function component. Let's do
> it right now! - ReactJS documentation

## useState
- It is a way to preserve values.
- It declares a state variable.
- It is a new way to use the same capabilities that this.state has in a class component.

## 📰 References
- [ReactJS documentation](https://pt-br.reactjs.org/docs/hooks-state.html)