-
-
Save Ateevduggal/1cada81ec4290307b576daccd8e5fd61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handleEditChange = (e) => { | |
const { name, value } = e.target; | |
setEditData({ ...editData, [name]: value }); | |
}; | |
const Save = (e) => { | |
e.preventDefault(); | |
let filterData = tableData.filter((e) => e.id !== editData.id); | |
let updatedData = [...filterData, { ...editData }].sort((a, b) => | |
a.id > b.id ? 1 : -1 | |
); | |
setTableData(updatedData); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment