Make a GET Request from React Native
Tiempo de lectura: < 1 minuto Reading time: < 1 minute If we want to retrieve data from a remote server, we can use the following code: var myHeaders = new Headers(); myHeaders.append(“Content-Type”, “application/x-www-form-urlencoded”); var requestOptions = { method: ‘GET’, headers: myHeaders }; fetch(“https://www.miweb.com/getPerson”, requestOptions) .then(response => response.json()) .then((responseJson) => { alert(responseJson); }) .catch(error => console.log(error)); First, we create the headers … Read more