This video is available to students only

Module 1 Summary

This lesson is a summary of the React Hooks we've covered in Module 1.0

This lesson is a summary of what we've covered in Module 1.0.

In this module, we learned:

Why hooks? What problems do they solve?#

The introduction of hooks into the React framework aimed to address problems that had arisen from only allowing state to exist in class-based components.

Problems like:

  • Logic that can't be reused between components

  • Classes that confuse people and machines

  • Components with so much stateful logic they're hard to understand

useState Hook#

Our first hook to get familiar with was the useState Hook, the hook most similar to this.state, which everyone who's worked with React for any length of time is familiar with.

We looked at some functional component examples employing useState and compared them to their state component equivalents.

useEffect Hook#

Next up, we looked at the useEffect Hook, the hook responsible for side effects like:

  • Data fetching

  • Updating the DOM

  • Subscribing to event listeners

Unlike React lifecycle methods, where disparate data is grouped together, and there are only a few methods to choose from, useEffect allows for many separate hooks whose side effects will only trigger when the variables they depend on change.

Start a new discussion. All notification go to the author.