1

I am new to react, would anyone help me on why is F5 and window.location.reload not work same way, please? In formSubmit method save a survey into database, if response it is ok, reload page by window.location.reload. However it didn't get the data back, page did reload, but if I hit F5, it gets the submitted value back on the page.

 formSubmit(guid) {
    console.log("Started");
    fetch("http://localhost:xxxx/api/survey/" + id + "/submit", {
        method:'POST'
    })
    .then((response) => {
      if(response.ok) {
         window.location.reload();
      }
      else {
        console.log('error');
      }
    })
    .catch(function(error){
      console.log('catch error');
    });
  }
user2235768
  • 283
  • 1
  • 4
  • 18

0 Answers0