Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const add = <Item, Store extends ItemsStore<Item>>(
- update: (this: void, updater: Updater<Store>) => void
- ) => (items: Array<Item>, isStart = false): void => {
- update((store) => {
- if (isStart) {
- store.items.unshift(...items);
- } else {
- store.items.push(...items);
- }
- store.count += items.length;
- store.skip += items.length;
- store.hasMore = store.items.length < store.count;
- return store;
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement