moon-hooks
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Moon Hooks

useList

import { useList } from "./useList";

const { list: persons, ...personsHandler } = useList([
  {
    name: "Sam",
    city: "shanghai",
  },
]);

personsHandler.update(
  (person) => person.name == "Sam",
  (person) => {
    person.name = "Lee";
  }
);

useListWithId

import { useListWithId } from "..";

const { list: persons, ...personsHandler } = useListWithId([
  {
    id: "user_123456",
    name: "Sam",
    city: "shanghai",
  },
]);

personsHandler.updateById("user_123456", (person) => {
  person.name = "Lee";
});

Readme

Keywords

none

Package Sidebar

Install

npm i moon-hooks

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

21.3 kB

Total Files

18

Last publish

Collaborators

  • mutemoon