Here's a rephrased version of your message:
I have created a custom SharePoint page using SPFx that displays data from a SharePoint list. I want users to be able to click on any item to open the list out of box edit form and have my page refresh when an item is updated or added. I also want to add a button to create a new item, which opens the out of box new form with the same functionality.
In classic SharePoint, I achieved this using:
javascript:
function openFormDialog(ID, listName) {
var baseUrl = _spPageContextInfo.siteAbsoluteUrl;
var myurl =`${baseUrl}/Lists/${listName}/EditForm.aspx?ID=${ID}`;
var options = {
url: myurl,
title: "Edit Item",
dialogReturnValueCallback: (result) => CloseCallback(result, myurl)
};
SP.SOD.execute('sp.ui.dialog.js','SP.UI.ModalDialog.showModalDialog',
options);
//return false;
}
//Thats how I used callback function.
async function CloseCallback(result, target) {
if (result === SP.UI.DialogResult.OK) {
}
}
//This is how we open any edit form by passing listname and thier item id.
openEditDialog(101,"Cars")
By using above code I can easily open any list any form in modal and based on user function I can easily call callback function .
How can I achieve similar functionality in SPFx?