---
title: "Comment by Benjamin Ik on \"Build a Custom Autocomplete Search Bar with React Hooks\" | Hashnode"
description: "In a situation where am not fetching data in the network, but fetching data from my local data array in my app (eg &#39;./contactData.js&#39;). How do I change"
url: "https://hashnode.com/posts/build-a-custom-autocomplete-search-bar-with-react-hooks/5f1a192a3535f04d3955147f/comment/607b8fc8eb2bd30d2d2269ef"
---

[Discussion](https://hashnode.com/posts/build-a-custom-autocomplete-search-bar-with-react-hooks/5f1a192a3535f04d3955147f)

Comment [Build a Custom Autocomplete Search Bar with React Hooks](https://hashnode.com/posts/build-a-custom-autocomplete-search-bar-with-react-hooks/5f1a192a3535f04d3955147f)

[Benjamin Ik](https://hashnode.com/@wiredmatrix)

[Apr 18, 2021](https://hashnode.com/posts/build-a-custom-autocomplete-search-bar-with-react-hooks/5f1a192a3535f04d3955147f/comment/607b8fc8eb2bd30d2d2269ef)

In a situation where am not fetching data in the network, but fetching data from my local data array in my app (eg './contactData.js'). How do I change the code below to get the data

const fetchData = async () => { const res = await fetch('[api.opendota.com/api/heroes&](https://api.opendota.com/api/heroes')); const json = await res.json(); setData(json); setHeroes(json.slice()); };
