Introduction to Reusable State and Effects with React Hooks

Elijah Manor
InstructorElijah Manor
Share this video with your friends

Social Share Links

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.

egghead
egghead
~ 9 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today