From 2c55c597b7a5fa9af1bd9b4c6a40f747ac4b1386 Mon Sep 17 00:00:00 2001 From: Kostas Minaidis Date: Mon, 23 Sep 2024 12:30:03 +0300 Subject: [PATCH] Refactor example and fix ESLint error Fix ESLint error: ``` "React Hook "React.useState" is called in function "cell" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. (react-hooks/rules-of-hooks)" ``` Related to: [https://github.com/TanStack/table/discussions/4205#discussioncomment-3206311](https://github.com/TanStack/table/discussions/4205#discussioncomment-3206311) --- examples/react/editable-data/src/main.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/react/editable-data/src/main.tsx b/examples/react/editable-data/src/main.tsx index 0b12a9fd8c..3f8e8d0277 100644 --- a/examples/react/editable-data/src/main.tsx +++ b/examples/react/editable-data/src/main.tsx @@ -26,7 +26,7 @@ declare module '@tanstack/react-table' { // Give our default column cell renderer editing superpowers! const defaultColumn: Partial> = { - cell: ({ getValue, row: { index }, column: { id }, table }) => { + cell: function Cell({ getValue, row: { index }, column: { id }, table }){ const initialValue = getValue() // We need to keep and update the state of the cell normally const [value, setValue] = React.useState(initialValue)