feat(core/hooks): add 'useList' hook#341
Conversation
| }); | ||
|
|
||
| const setAll = usePreservedCallback((values: T[]) => { | ||
| setList(values); |
There was a problem hiding this comment.
setAll passes the array reference directly (setList(values)) without copying, while useSet.setAll creates a new Set via new Set(values).
External mutations to the passed array could affect state. Non-blocking — just a consistency point.
kimyouknow
left a comment
There was a problem hiding this comment.
Clean implementation! The action set (push/insertAt/updateAt/removeAt/setAll/reset) covers array operations well without over-abstracting.
|
@kimyouknow Same issue as #342 — the merge commit ( |
|
Hi @sukvvon, just a heads-up: when I merged this PR, the merge commit was incorrectly attributed to me instead of you due to a non-squash merge. I've fixed this by squashing the commits and force-pushing to |
Overview
Add
useListhook for managing array state with stable action functions.Actions:
push,insertAt,updateAt,removeAt,setAll,resetChecklist
yarn run fixto format and lint the code and docs?yarn run test:coverageto make sure there is no uncovered line?