To persist user changes and react to data modifications (such as validation or persistence), use the onChange prop. The onChange callback is triggered every time a cell is changed.
In a controlled setup, you should manage the spreadsheet data in your component's state and pass the state setter to onChange.
import { useState } from "react";
import Spreadsheet from "react-spreadsheet";
const App = () => {
const [data, setData] = useState([
[{ value: "Vanilla" }, { value: "Chocolate" }, { value: "" }],
[{ value: "Strawberry" }, { value: "Cookies" }, { value: "" }],
]);
return <Spreadsheet data={data} onChange={setData} />;
};