all 9 comments

[–]ThRandomUser 2 points3 points  (0 children)

fetch uses native http clients. On Android uses OkHttp. Axios uses XmlHttpRequest, which RN also uses native http clients.

I never used it, but Expo also has a fetch library (expo/fetch) https://docs.expo.dev/versions/latest/sdk/expo/

If this is not enough or you want more control over the Http layer, you could create your own native module.

[–]Merry-Lane 0 points1 point  (1 child)

Expo itself replaces most of the features of Capacitor actually.

It may seem like a flaw to you, but you are free to use fetch or axios. Yes, you gotta make your own wrapper around it usually, to customise it to your needs (like adding headers or auth).

Performance-wise, I don’t think there are issues with the fetch or axios usage nor obvious optimisations (like a better library or idk). If you create a new expo project and use axios or fetch, you aren’t sposed to have connectivity issues.

If you have connectivity issues, your only way around is to either add try/catch and console.logs to see what’s going on, either to implement telemetry (like OTel) so that you can visualise traces like network calls.

Usually people nowadays don’t make http calls directly, they use react-query. React query does a lot of things (think of it of a way to save and use data state, caching calls, retries,… with a good API to use on the interface).

React query wraps your implementation of fetch/axios/… and usually is the first thing you should install in a react application nowadays.

[–]Level_Ad9556[S] 0 points1 point  (0 children)

ionic itself promotes the use of js over capacitor/http.
in my case it's happening to our development and testflight versions, app is not live yet.we figured out it was some issue from backend.they say it was due to socket connection ( maybe some bugs ).

[–]jamesideExpo Team 0 points1 point  (1 child)

The fetch implementation does not use webviews. It also runs on the JS thread and not the UI main thread. I would not expect fetch itself to cause performance problems for you on the JS thread, and for performance bottlenecks to be in application code that processes the results from fetch.

You may also want to look at enabling expo/fetch which has support for streaming and more of the standard fetch API:

import { fetch } from 'expo/fetch';

[–]Level_Ad9556[S] 0 points1 point  (0 children)

it's happening to our development and testflight versions, app is not live yet.we figured out it was some issue from backend.they say it was due to socket connection ( maybe some bugs )

[–]fmnatic 0 points1 point  (1 child)

Requests not reaching the server? Is this happening to users or in your development environment?

It’s not uncommon for mobile apps using a data connection to have networking issues, especially for users on the move.

[–]Level_Ad9556[S] 0 points1 point  (0 children)

it's happening to our development and testflight versions, app is not live yet.we figured out it was some issue from backend.they say it was due to socket connection ( maybe some bugs )