react native fetch

spfLinux發表於2018-01-31
import React,{Component} from 'react';
import {Button} from 'react-native';

export default class Demo10Component extends Component{
    handlePress(){
        fetch("http://176.51.6.120/admin/data/product_list.php").then((response)=>{
            return response.json();
        }).then((result)=>{
            console.log(result.data);
        })
    }
    render(){
        return <Button onPress={this.handlePress} title="點我"></Button>
    }
}

相關文章