Undefined is not an object React native – but displays data afterwards

I keep this error Undefined is not an object(evaluating ….), I find it funny, because I get the object when i make a correction and it refreshes, but when i open a app at first, i get the error, So i delete the part that has the error then the app loads, i then bring back the delete part, it will show correctly. Please help, Im just learning react.

Im not sure but i think there is a method that makes my app wait when it fetches the data, then its loads, rather than just load at first nonetheless…

This is my code please.

function ExploreScreen() {
  const getListingsApi = useApi(client.get(endpoint));

  useEffect(() => {
  }, []);

return ({getListingsApi && <Text>{getListingsApi.data[0].latitude}</Text>}) -this is the part i delete and bring back to ake it display.

I removed the parts that are working. This is just a brief version of the code, below is my useAPI hook

import { useState } from "react";

export default useApi = (apiFunc) => {
  const [data, setData] = useState([]);
  const [error, setError] = useState(false);
  const [loading, setLoading] = useState(false);

  const request = async (...args) => {
    const response = await apiFunc(...args);

    return response;

  return { data, error, loading, request };

122 thoughts on “Undefined is not an object React native – but displays data afterwards”

  1. Pingback: cialis 5 mg tablet
  2. Pingback: womens viagra
  3. Pingback: cialis 24 hours
  4. Pingback: viagra samples
  5. Pingback: sildenafil 20mg
  6. Pingback: viagra nz online
  7. Pingback: cialis 5mg
  8. Pingback: dapoxetine cialis
  9. Pingback: buy cialis
  10. Pingback: viagra para mujer
  11. Pingback: visual viagra
  12. Pingback: viagra homme
  13. Pingback: walmart viagra
  14. Pingback: brand viagra
  15. Pingback: viagra dosage
  16. Pingback: viagra generico
  17. Pingback: women viagra
  18. Pingback: sildenafil citrate
  19. Pingback: viagra pornhub
  20. Pingback: viagra cost

Leave a Comment