Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
My react app is working in browser but not in my mobile

I'm developing a react app, I want to try some functions in my mobile but when I try to connect to it, I have an error. I understand that is an asynchronus problem... I'm trying to map an (by the moment) undefined array. But I don't understand by in the browser is working well and in my mobile not.

const eventsFetch = async () => {
    const resEvents = await getAllEvents();
    const newArray = resEvents.filter((e) => {
        const date = new Date(e.date);

    return date.getTime() >= Date.now();
    });

    newArray.sort((e) => e.important === true ? -1 : 1);
    setEvents(newArray);
}

Here is an screenshot from the mobile browser.. I tried with Chrome, Safari and Brave and always I got the same error. enter image description here

By last, I already try adding the optional chaining operator to the array, but I have the same result.

EDIT: If I add a console.log with the result of the array after the filter and the sort, in my computer I can see that it's working fine. Here ah image: enter image description here

EDIT 2:

export const getAllEvents = async() => {
    try{
        const req = await fetch(getAllEventsUrl, {
            method: "GET",
            headers: {
                Accept: "application/json",
                "Content-Type": "application/json",
                "Access-Control-Allow-Origin": "*",
            },
            credentials: "include",
        });
    
        const response = await req.json();
    
        if (!req.ok) {
            const error = new Error(response)
            error.status = req.status;
            return error;
        }
        
        return response;
    } catch(error) {
        return error;
    }
};
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!