React JS HTTP Clients

fetch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fetch(
`${REACT_APP_API_URL}/equipment`,
{
signal: abortController.signal,
method: "GET",
headers: {
'Accept': 'application/json, text/plain',
'Content-Type': 'application/json;charset=UTF-8'
}
})
.then(response => response.json())
.then(json => {
//console.log(JSON.stringify(json));
//setEquipment(json);
})
.catch(error => console.log(error));

axios

1
npm i axios