# Error on ListingScreen after adding api

**URL:** <https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004>\
**Category:** React Native\
**Created:** [January 16, 2021, 1:00pm UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004 "2021-01-16T13:00:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tt703](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tt703](https://forum.codewithmosh.com/u/tt703)\
**Post date:** [January 16, 2021, 1:00pm UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004/1 "2021-01-16T13:00:01Z")

</div>

Ever since I added apisauce and backend, I’m getting the following error on ListingScreen.js.

 ![Screenshot 2021-01-16 at 3.49.14 PM](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/1X/47c6342fba405a5de8c88139e4e67dd86da3b8a6.jpeg)

Cant even debug properly because of this it seems. Thoughts?

---

<div class="post-metadata">

**Author:** ![dpickut](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@dpickut](https://forum.codewithmosh.com/u/dpickut)\
**Post date:** [January 16, 2021, 3:48pm UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004/2 "2021-01-16T15:48:00Z")

</div>

It looks like ListingScreen.js is not getting the listings object – so you need to backtrack through the components that get the list from the backend and look for errors.

This includes all the components and imported (listingsApi from api/listings, useApi from hooks/useApi).

Make sure that the dev apiUrl is correct in config/settings.js. I ran into a problem with this when I had to reset my wireless router and it assigned a new IP address to my laptop.

Also, if you didn’t already, verify that your backend is working using Postman.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Vssign88](https://avatars.discourse-cdn.com/v4/letter/v/a587f6/32.png) [@Vssign88](https://forum.codewithmosh.com/u/Vssign88)\
**Post date:** [January 22, 2021, 2:02am UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004/3 "2021-01-22T02:02:24Z")

</div>

I have the same issue when the app is connected to backend. ☹

The backend is working properly and was checked through Postman. The problem seems to be related to **.data** part of response.data which is not recognized on the frontend ( the received API data can be printed on the console only using console.log(response) and not when .data is added). Any suggestion on how to fix this problem ?

---

<div class="post-metadata">

**Author:** ![tt703](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tt703](https://forum.codewithmosh.com/u/tt703)\
**Post date:** [January 22, 2021, 1:27pm UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004/4 "2021-01-22T13:27:24Z")

</div>

went back into the files and as it turns out, made a stupid typo in listings.js :

const endpoint = “./listings”;

(inserted the dot at the beginning). all working now, thanks!

---

<div class="post-metadata">

**Author:** ![dpickut](https://avatars.discourse-cdn.com/v4/letter/d/a87d85/32.png) [@dpickut](https://forum.codewithmosh.com/u/dpickut)\
**Post date:** [January 22, 2021, 10:01pm UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004/5 "2021-01-22T22:01:43Z")

</div>

Did you try JSON.stringify(response.data)?

---

<div class="post-metadata">

**Author:** ![zenadar](https://avatars.discourse-cdn.com/v4/letter/z/ed8c4c/32.png) [@zenadar](https://forum.codewithmosh.com/u/zenadar)\
**Post date:** [August 19, 2021, 1:47pm UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004/6 "2021-08-19T13:47:49Z")

</div>

I am stuck on the same error sadly ☹ … I’ve tried checking all over stack overflow etc about keyExtractor in FlatList but it’s just confirming the way im doing it is correct. Alongside this, checking my listings screen in comparison to mosh’s - my keyExtractor is exactly the same so there should be no issue… I would appreciate any help!

---

<div class="post-metadata">

**Author:** ![zenadar](https://avatars.discourse-cdn.com/v4/letter/z/ed8c4c/32.png) [@zenadar](https://forum.codewithmosh.com/u/zenadar)\
**Post date:** [August 19, 2021, 1:48pm UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004/7 "2021-08-19T13:48:31Z")

</div>

I also tried changing the dot at the beginning of ‘./listings’ and did not fix my issue sadly ☹

---

<div class="post-metadata">

**Author:** ![daniel.letelier](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@daniel.letelier](https://forum.codewithmosh.com/u/daniel.letelier)\
**Post date:** [August 8, 2024, 2:46pm UTC](https://forum.codewithmosh.com/t/error-on-listingscreen-after-adding-api/2004/9 "2024-08-08T14:46:36Z")

</div>

Did you check if you have missed the ‘()’ to the end of toString function?
