Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to get response data from Axios and map to the custom object

$
0
0

How I can map the response data object from axios to custom object? Here is the code below.Can I use map? As in, response.data.results.map?

   public getAllPromise(): Promise<any[]> {        return new Promise((resolve, reject) => {            axios.get('https://www.xxxx').then((response) => {                resolve(response.data.results);                console.log(response +' -----from service');            }).catch((error) => {                reject(error);            });        });    }

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>