A custom React hook that lets you manipulate an array data structure without ever needing extra utilities.
Start with:
npm install --save use-arrayThen, import and use the hook:
importuseArrayfrom'use-array'// …in your functional component:const[list,{
set, empty, replace, push,
updateAt, setAt, removeAt,
filter, map, sort, reverse,
mergeBefore, mergeAfter,}]=useArray(defaultList);The complete documentation as well as a live demo is available here.
MIT © filipdanic