cancel button should refresh the page

Viewed 55

I have a cancel button it should not update the data into database and it should refresh my page,but in my case page is not refreshing

<Button onClick={() => searchDiagnosisCode()}>Cancel</Button>
 const searchDiagnosisCode = () => {
props.setConfirm(true);
setTimeout(function () {
  props.history.push({
    pathname: '/DiagnosisCodeSearch',
    editPage: true,
  });
}, 10);

};

1 Answers

try window.location.reload(); to refresh the page

<Button onClick={() => searchDiagnosisCode()}>Cancel</Button>

const searchDiagnosisCode = () => {
 props.setConfirm(true);
 setTimeout(function () {
   window.location.reload();
}, 10);
Related