Created
December 8, 2023 08:13
-
-
Save rmdort/a9c41bb6e3615768badaec06c07efefe 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
// Option 1 - With useSpreadsheetState hook | |
// Calculator has to expose the following functions | |
/* | |
getPrecedents, | |
getPrecedentsFromFormulaString, | |
getDependents, | |
getGraphNodes, | |
*/ | |
export const Spreadsheet = () => { | |
const { onChange, onFill } = useSpreadsheetState({ | |
disableCalculation: true, | |
}) | |
return ( | |
<CanvasGrid | |
onChange={(sheetId, cell, value) => { | |
// Update local state | |
onChange() | |
// Send this value to hyperformula | |
}) | |
onFill={(sheetId, cell, value) => { | |
// Update local state | |
onFill() | |
// Send this value to hyperformula | |
}) | |
/> | |
) | |
} | |
// Option 2 | |
Completely headless and your own state management |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment