The body must be a string, usually JSON stringified, not a plain object.
Step 2: Identify missing JSON.stringify
Here, body is an object { name: 'Alice' } which causes an error; it should be JSON.stringify({ name: 'Alice' }).
Final Answer:
body should be a JSON string, not an object -> Option B
Quick Check:
body = JSON.stringify(object) [OK]
Hint: Always JSON.stringify body for POST requests [OK]
Common Mistakes:
Passing object directly as body
Forgetting Content-Type header
Using wrong HTTP method
5. You want to send user data with a POST request and handle errors gracefully in React Native. Which code snippet correctly implements this with async/await and error handling?
A)