main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
502 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import { __assign } from "tslib";
|
---|
| 2 | import useList from './useList';
|
---|
| 3 | /**
|
---|
| 4 | * @deprecated Use `useList` hook's upsert action instead
|
---|
| 5 | */
|
---|
| 6 | export default function useUpsert(predicate, initialList) {
|
---|
| 7 | if (initialList === void 0) { initialList = []; }
|
---|
| 8 | var _a = useList(initialList), list = _a[0], listActions = _a[1];
|
---|
| 9 | return [
|
---|
| 10 | list,
|
---|
| 11 | __assign(__assign({}, listActions), { upsert: function (newItem) {
|
---|
| 12 | listActions.upsert(predicate, newItem);
|
---|
| 13 | } }),
|
---|
| 14 | ];
|
---|
| 15 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.