This is the repository for Practical React Hooks, to learn and understand custom hooks and how to use them in your React applications.
You are expected to have a basic understanding of React and JavaScript. You should be experienced with useState
, useEffect
, and useRef
. To learn more about the basics of React, check out the React documentation and the Beta Docs of React.
- Node.js (v16 or higher)
- Yarn (v1.22 or higher)
- Git
- Visual Studio Code (optional)
- Fork this repository
- Clone your forked repository
- Run
yarn
to install the dependencies - For each exercise, run
yarn test <exercise-number>
to run the tests for that exercise. For example, to run the tests for exercise 1, runyarn test 01-use-persist
- For each exercise, create a new branch to work on. For example, to work on exercise 1, create a new branch called
<name>/01-use-persist
- The tests for the exercise will fail. Make the tests pass by editing the
src/exercises/<exercise-number>/hook.ts
file - Submit a pull request when you are done with an exercise
- Exercise 1:
usePersist
- Exercise 2:
useInterval
- Exercise 3:
useKey
- Exercise 4:
useFetch
- Exercise 5:
useDebounce
- Exercise 6:
useEventListener
- Exercise 7:
usePrevious
- Exercise 8:
useAsync
- Exercise 9:
useOnClickOutside
MIT