https://github.com/drag13/react-hooks-examples
This is the collection of examples for the course React for Beginners from Itera
https://github.com/drag13/react-hooks-examples
Last synced: about 1 year ago
JSON representation
This is the collection of examples for the course React for Beginners from Itera
- Host: GitHub
- URL: https://github.com/drag13/react-hooks-examples
- Owner: Drag13
- Created: 2022-05-04T12:39:05.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-11T15:14:42.000Z (about 4 years ago)
- Last Synced: 2025-02-13T01:54:14.364Z (over 1 year ago)
- Language: TypeScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React hooks examples for the Free React Course For Beginners by Itera
## Install
```cmd
npm ci
```
## Run examples:
### State
State - a way to store the data that is subject to change!
```cmd
npm run start:state
```
For the complex states - take a look into the useReducer
### Effect
Effect - a way to intercept lifecycle events and perform side effects
```cmd
npm run start:effect
```
### Context
Context - a transport that allows you to get anything in the components without accessing props
```cmd
npm run start:context
```
### Callback
Callback - a way to memoize the function
```cmd
npm run start:callback
```
### Custom
Writing custom callback
```cmd
npm run start:custom
```
## Takeaways
- Hook - a modern to API to functional components
- Most useful are useState, useEffect
- You can write your own hooks