1import { useCallback, useState } from 'react';
4 * Manages an immutable array of items.
6export default function useArray(initialItems = [], itemBuilder) {
7 const [items, _setItems] = useState(initialItems);
9 const append = () => _setItems(items => [...items, itemBuilder()]);
13 const newItems = [...items.slice(0, i), ...items.slice(i + 1)];
14 console.log(items.length, newItems.length);
18 const updateAt = (i, update = {}) =>
25 ...items.slice(i + 1),
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list