I'm making a fetch request from react-native. Why will A send the body data correctly, but B come back as undefined?
let usrn = 'ususus'
lew pwrd = 'pwpwpw'
let bodyData = {
'u': usrn,
'p': pwrd,
}
Specifically the body data with JSON.stringify()?
=> A
return fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify({
'u': usrn, // <= can return this value on server
'p': pwrd, // <= can return this value on server
})
})
=> B
return fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify({ bodyData }) // <= returns undefined on server
})