react jsx - How to make a rest post call from ReactJS code? -


i new reactjs , ui , wanted know how make simple rest based post call reactjs code.

if there example present helpful.

thanks.

straight react docs:

fetch('https://mywebsite.com/endpoint/', {   method: 'post',   headers: {     'accept': 'application/json',     'content-type': 'application/json',   },   body: json.stringify({     firstparam: 'yourvalue',     secondparam: 'yourothervalue',   }) }) 

(this posting json, do, example, multipart-form.)


Comments