Skip to content

Instantly share code, notes, and snippets.

@Ackuq
Created July 31, 2019 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ackuq/5f338e3cfefadb9d3715ea7268f24ac5 to your computer and use it in GitHub Desktop.
Save Ackuq/5f338e3cfefadb9d3715ea7268f24ac5 to your computer and use it in GitHub Desktop.
import Config from 'react-native-config';
export const fetchApiData = async route => {
try {
const response = await fetch(Config.API_URL + route);
const json = await response.json();
return json;
} catch (error) {
console.error(error);
return null;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment