Skip to content

2 - What are custom hooks

Course: Custom Hooks - chapter 2

Hooks that you create yourself, so other people can use them are called custom hooks.

A custom hook is effectively a function, but with the following properties -

  1. Uses another hook internally (useState, useEffect, another custom hook)
  2. Starts with use

A few good examples of this can be

  1. Data fetching hooks
  2. Browser functionality related hooks - useOnlineStatus , useWindowSize, useMousePosition
  3. Performance/Timer based - useInterval, useDebounce