Skip to content

Instantly share code, notes, and snippets.

@Ateevduggal
Last active Jun 11, 2022
Embed
What would you like to do?
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