fetch post send data api in react js code example
Example: fetch api template
//fetch api template
const fetchData=(inputs)=>{
fetch('https://example.com/api', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(inputs)
})
.then(function(response) {
return response.json();
})
.then(function(data) {
ChromeSamples.log(data.whatever);
});
}