Build Your Own Hooks

Let's start with writing your first React hook.

From the start of the hooks chapter, we’ve taken and used candies from the candy box React provides.

However, React also provides a way for you to make your own unique candies called custom hooks.

How does that work?

A custom hook is just a regular function. However, its name must begin with the word, use. If needed, it may call any of the React hooks within itself.

Below is an example:

Get hands-on with 1000+ tech skills courses.