Starting with 16.8.0, React includes a stable implementation of React Hooks for: React DOM, React Native, React DOM Server, React Test
Renderer, and React Shallow Renderer. Note that to enable Hooks, all React packages need to be 16.8.0 or higher. Hooks won’t work if you
forget to update, for example, React DOM. React Native 0.59 and above support Hooks.
Do I need to rewrite all my class components?
No. There are no plans to remove classes from React — we all need to keep shipping products and can’t afford rewrites. We recommend trying
Hooks in new code.
What can I do with Hooks that I couldn’t with classes?
Hooks offer a powerful and expressive new way to reuse functionality between components. “Building Your Own Hooks” provides a glimpse of
what’s possible. This article by a React core team member dives deeper into the new capabilities unlocked by Hooks.
How much of my React knowledge stays relevant?
Hooks are a more direct way to use the React features you already know — such as state, lifecycle, context, and refs. They don’t
fundamentally change how React works, and your knowledge of components, props, and top-down data flow is just as relevant. Hooks do have a
learning curve of their own. If there’s something missing in this documentation, raise an issue and we’ll try to help.
Should I use Hooks, classes, or a mix of both?
When you’re ready, we’d encourage you to start trying Hooks in new components you write. Make sure everyone on your team is on board with
using them and familiar with this documentation. We don’t recommend rewriting your existing classes to Hooks unless you planned to rewrite
them anyway (e.g. to fix bugs). You can’t use Hooks inside a class component, but you can definitely mix classes and function components
with Hooks in a single tree. Whether a component is a class or a function that uses Hooks is an implementation detail of that component. In
the longer term, we expect Hooks to be the primary way people write React components.