React 16.8 introduced a new feature called Hooks. Hooks are functions that you can use to manage a components state and lifecycle methods. Hooks make it possible to - add state to a functional component - manage a component's lifecycle without using a class component. In both componentDidMount and componentWillUnmount, we're customizing the behavior of the app based on the window's resize event.

12m read timeFrom patterns.dev
Post cover image
Table of contents
Class componentsHooksCustom HooksAdditional Hooks guidance
5 Comments

Sort: