Releasing Hooks for React 16.8 on Facebook's Engineering blog

WHAT’S NEW:

We’ve released React Hooks, a powerful new way to write components and reuse code between them. React 16.8 is the first stable React release with support for Hooks. React Native will also support Hooks in its 0.59 release. Hooks are fully backward compatible and work alongside your existing code.

WHY IT MATTERS:

Hooks provide a way to reuse code with encapsulated state and side effects via functions. Hooks let us organize the logic inside a component into reusable isolated units. Unlike patterns such as render props and higher-order components, Hooks don’t introduce unnecessary nesting into your component tree. They also don’t suffer from the drawbacks of mixins.

USE IT FOR:

Hooks are functions that let you “hook into” React state and lifecycle features from function components. Hooks don’t work inside classes — they let you use React state and other features via functions, without classes. (We don’t recommend rewriting your existing components overnight, but you can start using Hooks in the new ones, if you’d like.) React provides a few built-in Hooks, like useState. You can also build your own Hooks to share reusable stateful logic between components. Start using Hooks.

GET IT ON GITHUB:

Start using Hooks
Hooks on github

To help personalize content, tailor and measure ads, and provide a safer experience, we use cookies. By clicking or navigating the site, you agree to allow our collection of information on and off Facebook through cookies. Learn more, including about available controls: Cookies Policy