I use ReactJS and axios I try to GET data customer
React: 16.5.2
axios: 0.18.0
I have a class with constructor:
constructor(props) {
super(props);
this.state = {
reactTable: reactTableData(),
reactBootstrapTable: reactBootstrapTableData(),
dataCustomer: customerData(),
};
method customerData() :
export function customerData(){
// axios get
return axios.get("my/url")
.then(res => {
let data = res.data.data;
console.log(data);
return data
})
.catch(err => {
console.log(err);
})
}
when I am console.log(this.state);
I got Promise data like this:
I still new with ReactJS and I hope you can help me,
thanks.