To begin, let's start with something fairly basic. React Native implements the Fetch API, which is nowadays a standard for making REST API calls.
Fetching data with the built-in function
Refactoring to activity indicator
Currently, we have a default task list being loaded from the file in taskReducer.js. To be honest, loading from either the file or API can be time consuming. It will be better initially to set the task list to empty the array and provide feedback to the user with a spinner or text message, informing them that the data is being loaded. We will implement this along with the change to the Fetch API.
First, remove data import from the file in the reducer. Change the declaration from the following:
(state...