how to send form data to an api with axios in react code example
Example: axios react post form data
var body = {
userName: 'Fred',
userEmail: '[email protected]'
}
axios({
method: 'post',
url: '/addUser',
data: body
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});