React Hooks

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

  1. State Hooks (useState)
  2. Context Hooks (useEffect )
  3. Ref Hooks (useRef )
  4. Effect Hooks (useEffect )
  5. Performance Hooks
  6. Other Hooks
  7. Your own Hooks (Custom Hooks)

Leave A Comment