-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Hi,
First, I'm trying v7, it's awesome to work with Hooks! Trying it for the first time so my comments might be wrong.
Describe the bug
This are more of an architecture comment than a bug:
If you disable useExpanded
hook, the table breaks.
I know in userland you can't disable this hook but the fact that this happens, (edit: actually you can) probably demonstrates wrong app design: I figured out this is happening because you're building initial state within the useExpanded
hook (row.cells = ...
).
Expected behavior
I think that adding or removing hooks should not break the entire component. Hooks should be encapsulated.
Codesandbox!
https://codesandbox.io/s/nk9rmym6m4
Solution
That initial state logic could be within useTable
itself (tested and works fine).
I can provide a PR if needed.