I want to show a JSON in my web. Im consuming an API with a security token, all is good until i want to show the data of the json in my page, and its only there because in my console i can see the data. I hope you can helpme.
import React from 'react';
import axios from 'axios';
const Table = () => {
const url = 'someApi';
const token = 'someToken'
axios(url, {
method: 'get',
headers: {
'Authorization': `Bearer ${token}`
},
'body': JSON.stringify({
name: this.state.name,
quantity: this.state.quantity,
price: this.state.price,
})
})
// .then(response => response.json())
.then(response => {
console.log(response);
})
.catch(error => console.error(error));
return(
<>
<table>
<thead>
<tr>
<th>sku</th>
<th>name</th>
<th>quantity</th>
<th>price</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</>
)
}
export default Table;