On this page
Chapter 3 – React : Introduction of Hooks
Chapter 3 – React : Introduction of Hooks
September 12, 2020
On this page
Introducing Hooks
Hooks in React are a new addition in Version 16.8. They let you use different React features from your components without writing a class. You can either use the built-in Hooks or combine them to build your own.
What is a Hook?
A Hook is a special function that lets you “hook into” React features. For example, useState is a Hook that lets you add React state to function components. We’ll learn other Hooks later.
When would I use a Hook?
If you write a function component and realize you need to add some state to it, previously you had to convert it to a class. Now you can use a Hook inside the existing function component. We’re going to do that right now!
Built-in Hooks in React
- State Hooks (useState)
- Context Hooks (useEffect )
- Ref Hooks (useRef )
- Effect Hooks (useEffect )
- Performance Hooks
- Other Hooks
- Your own Hooks (Custom Hooks)