lundi 22 mai 2017

How to reloads the table when clicked reactjs

Hi I was wondering how will I reload only the table not the whole page on reactjs ive tried using history.go(0);but however it reloads the whole page please check if how can i reload it i was goinh to use forceUpdate but based on research you should avoid using it ...

my code for the onclick

 handleSubmit( name, address,department){

 const laman = {
      'Employee_Name': name,
      'Address': address,
      'Department': department
    }
    return fetch('http://localhost:5118/api/employeedetails/PostEmployeeDetail?', {
        method: 'POST',
        headers: {
        'Content-Type': 'application/json'
        },
        body: JSON.stringify(laman)
    })
    .then(function(response) {
      console.log(response)
      return response.json();
    })
    .then(function (result) {
      history.go(0);
    })
    .catch(function(error) {
      console.log(error);

    })
}




Aucun commentaire:

Enregistrer un commentaire