Accepted answer

To send HTTP requests from React app, you have two main options.

Either use integrated Fetch API ( or something like axios (

In order to get info from the form, trigger onChange on each input, and save the input state to component state.

onChange = (prop: any, value: string) => {
    [prop]: value

After that, here's an example using fetch API:

const response = fetch("endpoint_url", {
  method: 'POST',
  body: JSON.stringify({,
    // Other body stuff
  headers: {
    'X-Api-Key': API_KEY,
    'Content-Type': 'application/json'
    // Other possible headers

And in the end you need to parse the response as JSON using const responseJson = response.json();

Related Query

More Query from same tag