priyanka
priyanka

Reputation: 181

React native - post raw text data

I want to send this type data in raw text format using react native. please help-

submit Qsubmit_form=1&form_noresubmit_code=1525265560&question=OKKKK NEW APPP&submit=

Upvotes: 3

Views: 3067

Answers (1)

pritam
pritam

Reputation: 2558

You can use fetch API for both GET and POST requests. Example of POST request:

fetch('https://mywebsite.com/endpoint/', {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    firstParam: 'yourValue',
    secondParam: 'yourOtherValue',
  }),
});

You can check out official docs for networking here

Upvotes: 3

Related Questions