I have react native app using the default template which includes the default launch screen. In release mode, the launch screen only showed for a fraction of a second so I added the below (to AppDelegate) to force it to pause for 2 seconds.
[NSThread sleepForTimeInterval:2.000];
My question is: is there a way to call my api to load data during this pause time?
Presently after the launch screen my main app screen loads which calls an API on mount and displays the data. It would be ideal if I could pre-fetch the data to avoid the wait time after the main app screen loads.
This is the way I call my api on mount of the app:
useEffect(() => {
(async function (){
const response = await fetch('https://myapi...');
...
...
})();
}, []);