T
TanStack2y ago
metropolitan-bronze

onStateChange is not getting called

Hello, I'm unable to listen to table state chnage.
const [state, setState] = useState<any>()
console.log(state)
const table = useReactTable({
onColumnVisibilityChange: enableColumnVisibility ? setColumnVisibility : undefined,
onExpandedChange: enableExpanding ? setExpanded : undefined,
onSortingChange: enableSorting ? setSorting : undefined,
onStateChange : setState
....}
const [state, setState] = useState<any>()
console.log(state)
const table = useReactTable({
onColumnVisibilityChange: enableColumnVisibility ? setColumnVisibility : undefined,
onExpandedChange: enableExpanding ? setExpanded : undefined,
onSortingChange: enableSorting ? setSorting : undefined,
onStateChange : setState
....}
this doesn't updating the state value, even if the sorting and colVisibility changes Here is the codesanbox - https://codesandbox.io/p/sandbox/inspiring-river-ww4tf7
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?