<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-write-custom-react-hooks-g211qhlgk" -->

---
title: how to write custom react hooks | daily.dev
description: Custom hooks are nothing more than a normal javascript function whose name starts with "use" The main reason for creating custom hooks is to follow the "DRY"...
canonical: https://daily.dev/posts/how-to-write-custom-react-hooks-g211qhlgk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: how to write custom react hooks | daily.dev
og:description: Custom hooks are nothing more than a normal javascript function whose name starts with "use" The main reason for creating custom hooks is to follow the "DRY"...
og:url: https://daily.dev/posts/how-to-write-custom-react-hooks-g211qhlgk
og:image: https://api.daily.dev/og/posts/g211qhLgK.png
og:image:alt: how to write custom react hooks
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# how to write custom react hooks

**[Hashnode](https://daily.dev/sources/hashnode)** · 4 min read · 41 upvotes · 0 comments

## Summary

Custom hooks are nothing more than a normal javascript function whose name starts with "use" The main reason for creating custom hooks is to follow the "DRY" (Don't repeat yourself) principle. To implement such a feature, we can simply create this custom hook, and call it whenever and wherever we want. For this tutorial, we will be creating a simple react app which will render a random dad joke.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://ashishpandagre.hashnode.dev/react-custom-hooks-are-easy-than-you-think>

---

Tags: [#react](https://daily.dev/tags/react)

[View this post on daily.dev](https://daily.dev/posts/how-to-write-custom-react-hooks-g211qhlgk)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"how to write custom react hooks","url":"https://daily.dev/posts/how-to-write-custom-react-hooks-g211qhlgk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-write-custom-react-hooks-g211qhlgk"},"datePublished":"2022-07-06T13:40:44.665Z","dateModified":"2022-07-06T13:40:44.664Z","description":"Custom hooks are nothing more than a normal javascript function whose name starts with \"use\" The main reason for creating custom hooks is to follow the \"DRY\"...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/eef51e5f212ff97f2a2c97686109e0b5","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/eef51e5f212ff97f2a2c97686109e0b5","isAccessibleForFree":true,"articleSection":"Hashnode","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hashnode","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/4a287b2e7cb5499bae863f8e7137cdb4","url":"https://daily.dev/sources/hashnode"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-write-custom-react-hooks-g211qhlgk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":41},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"react","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hashnode","item":"https://daily.dev/sources/hashnode"},{"@type":"ListItem","position":3,"name":"how to write custom react hooks"}]}
```

