📝 Edit page
➕ Add page
Hooks
Manage state in React components
Topics
Pages
- Callback hook
- Context hook
- Custom hooks
-
Effect hook
Perform side effects in Function components
- Importing
-
Overview
All available hooks
- Rules of hooks
- State hook
Content
Hooks were added in React 16.8 and let you use state and lifecycle methods in a functional component, where before you had to use a class component.
Note that hooks must be used in functions and not nested within each other. You cannot add a useState
hook within a useEffect
hook.
Resources
- Intro to Hooks in the docs.
- Hooks at a glance