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
- Host: GitHub
- URL: https://github.com/joaopaulopmedeiros/learning-react-hooks
- Owner: joaopaulopmedeiros
- Created: 2020-10-28T16:31:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-02T18:04:11.000Z (over 5 years ago)
- Last Synced: 2025-03-25T10:13:01.108Z (about 1 year ago)
- Topics: hooks-api-react, reactjs
- Language: JavaScript
- Homepage:
- Size: 223 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)