Raja Muhammad Asher
Raja Muhammad Asher

Follow

Raja Muhammad Asher

Follow
What are Custom Hooks?

Photo by Lautaro Andreani on Unsplash

What are Custom Hooks?

Raja Muhammad Asher's photo
Raja Muhammad Asher
·Sep 1, 2022·

1 min read

Building your own Hooks lets you extract component logic into reusable functions. When we want to share logic between two JavaScript functions, we extract it to a third function. Both components and Hooks are functions, so this works for them too!

A custom Hook is a JavaScript function whose name starts with ”use” and that may call other Hooks.

Sources:

Building Your Own Hooks –. (n.d.). React. reactjs.org/docs/hooks-custom.html

 
Share this