Introduction to Reusable State and Effects with React Hooks

Elijah Manor
InstructorElijah Manor

Share this video with your friends

Send Tweet
Published 5 years ago
Updated 3 years ago

In this course we start by getting your environment setup for hooks and then we’ll introduce the idea of adding state to a function component and unpacking several ways to interact with that state.

There are a few rules that you need to follow when you start using hooks, but thankfully there's a custom ESLint plugin that’ll help enforce these rules. I’ll show how to setup the hooks plugin and talk about some of the rules that should be followed.

Things get more interesting and involved once we introduce side-effects to our function component with the useEffect hook. We’ll uncover numerous things to consider while using this particular hook.

One of the cool features of hooks is that it’s easy to abstract out code for reuse with custom hooks. The React community has already created lots of custom hooks that you can start playing with today.

Once I've introduced the main concepts of useState and useEffect, I'll start to unpack other hooks such as useRef, useReducer, useContext, useMemo, and useCallback.