---
title: "Discussion on \"Stop Repeating Yourself: A Smarter Way to Fetch Data in React with Custom Hook\" | Hashnode"
description: "Discussion on \"Stop Repeating Yourself: A Smarter Way to Fetch Data in React with Custom Hook\". Create a custom React hook for efficient data fetching, reducing code duplication and simplifying error handling for cleaner components"
url: "https://hashnode.com/posts/stop-repeating-yourself-a-smarter-way-to-fetch-data-in-react-with-custom-hook/67da48e429e753eb3fd7b371"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Stop Repeating Yourself: A Smarter Way to Fetch Data in React with Custom Hook](https://lahirushiran.hashnode.dev/stop-repeating-yourself-a-smarter-way-to-fetch-data-in-react-with-custom-hook?utm_source=hashnode&utm_medium=feed)

Create a custom React hook for efficient data fetching, reducing code duplication and simplifying error handling for cleaner components

Mar 19, 2025 · 3 min read · lahirushiran.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#react-hooks](https://hashnode.com/tag/react-hooks)
-   [#axios-in-react](https://hashnode.com/tag/axios-in-react)
-   [#data-fetching](https://hashnode.com/tag/data-fetching)

## Written by

[Lahiru Shiran](https://hashnode.com/@lahirushiran)

@lahirushiran · Sri Lanka

  
[View profile](https://hashnode.com/@lahirushiran)

Building Scalable Apps with React & Spring Boot.

## Responses 1

Markdown supported · ⌘↵ to post

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Mar 21, 2025](https://hashnode.com/posts/stop-repeating-yourself-a-smarter-way-to-fetch-data-in-react-with-custom-hook/67da48e429e753eb3fd7b371/comment/67dda50e0f69495f4a13b4eb)

You should create the hook without using `axios`.

[This is why axios, ky and others are not good choices](https://webjose.hashnode.dev/the-ugly-truth-all-popular-fetch-wrappers-do-it-wrong)

[Lahiru Shiran](https://hashnode.com/@lahirushiran)

[Apr 10, 2025](https://hashnode.com/posts/stop-repeating-yourself-a-smarter-way-to-fetch-data-in-react-with-custom-hook/67da48e429e753eb3fd7b371/comment/67dda50e0f69495f4a13b4eb#reply-67f70f2966176925d31a712a)

good point Using fetch helps keep things lightweight
