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
....}

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
Was this page helpful?