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

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

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