Skip to content
Advertisement

Send Data to a Server using Fetch API in React Native

I want to send data of Contact Form[firstname,lastname,email,note] to a server but When I click Contact Button to Send data I got an e=Error Telling that firstname is not defined The mean that all the 5 variables not defined if Some Can Help This The Code of FormScreen.js:

JavaScript

This is The Error : enter image description here

Advertisement

Answer

It is because you never defined the variables in the body:

JavaScript

Use this part as the body

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement