Getting Started with Hooks

One of the most anticipated new features of React is Hooks, an API that allows your functional components to "Hook" into React functionality. The overarching motivation for this feature is to simplify your components. For example, forcing React developers to use classes to define their components leads to the overuse of wrapper components to pass state around their apps. With Hooks, you can stick with simple functions to implement your components and have a clear picture of how everything fits together.

In this chapter, we'll cover the following topics:

  • Maintaining state using Hooks
  • Performing initialization and cleanup actions
  • Sharing data using context Hooks
  • Using reducer Hooks to scale state management

Technical ...

Get React and React Native - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.