{"id":23138110,"url":"https://github.com/roman-koshchei/mutato","last_synced_at":"2026-05-06T00:31:50.223Z","repository":{"id":65420901,"uuid":"555818370","full_name":"roman-koshchei/mutato","owner":"roman-koshchei","description":"Lightweight mutable react state","archived":false,"fork":false,"pushed_at":"2023-05-27T10:07:42.000Z","size":466,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-17T21:39:25.619Z","etag":null,"topics":["mutable","mutato","react","state","state-management","store","typescript"],"latest_commit_sha":null,"homepage":"https://mutato.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roman-koshchei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-22T12:02:13.000Z","updated_at":"2022-10-30T07:17:51.000Z","dependencies_parsed_at":"2024-11-10T01:02:16.384Z","dependency_job_id":"76072d4d-9eca-4ecc-8d06-d4bdc6c4a537","html_url":"https://github.com/roman-koshchei/mutato","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":"0.24137931034482762","last_synced_commit":"fa59a67a2bd8891a1f5c5b4b1dfd1bb43340f4f7"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/roman-koshchei/mutato","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roman-koshchei%2Fmutato","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roman-koshchei%2Fmutato/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roman-koshchei%2Fmutato/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roman-koshchei%2Fmutato/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roman-koshchei","download_url":"https://codeload.github.com/roman-koshchei/mutato/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roman-koshchei%2Fmutato/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273301875,"owners_count":25081105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mutable","mutato","react","state","state-management","store","typescript"],"created_at":"2024-12-17T13:09:46.863Z","updated_at":"2026-05-06T00:31:50.161Z","avatar_url":"https://github.com/roman-koshchei.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](assets/mutato-github.png)\n\nHow I expect it to work. It's especially comfortable during working with arrays. Motivated by [valtio](https://github.com/pmndrs/valtio).\n\n```bash\nnpm install mutato\n# or\nyarn add mutato\n```\n\n## useMutato\nShared state (rerender parent components)\n\n```tsx\n\nlet store = {\n  nums: [34, 45, 87],\n  selected: -1\n}\n\nconst Parent = () =\u003e {\n  // say that we want track chenges of store\n  useMutato(store)\n\n  return \u003cdiv\u003e\n    {store.nums.map((num, i) =\u003e \u003cChild key={num} val={num} i={i} /\u003e)}\n  \u003c/div\u003e\n}\n\n\nconst Child = ({val, i}: {val:number, i: number}) =\u003e {\n  // can not call useMutato if you sure\n  // that parent component will call useMutato\n  // but in that example let's do it\n  useMutato(store)\n\n  // swap of 2 items if one selected\n  const swap = () =\u003e mutate(() =\u003e {\n    if (store.selected == -1) {\n      store.selected = i\n    } else {\n      store.nums[i] = store.nums[store.selected]\n      store.nums[store.selected] = num\n      store.selected = -1\n    }\n  }, [store])\n\n  return (\n    \u003cbutton onClick={click}\n    style={store.selected == i ? { backgroundColor: 'steelblue' } : undefined\n    \u003e\n    {num}\n    \u003c/button\u003e\n  )\n}\n\n```\n\n## useLocalMutato\nDoesn't rerender parent components. Need less memory.\n\n```tsx\n\nlet store = {\n  items: [34, 45, 87]\n}\n\nconst SwapComponent = () =\u003e {\n  const mutate = useLocalMutato(store)\n\n  // simple swap of 2 items\n  const swap = () =\u003e mutate(store =\u003e {\n    const first = store.items[0]\n    store.items[0] = store.items[1]\n    store.items[1] = store.first\n  })\n\n  return ...\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froman-koshchei%2Fmutato","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froman-koshchei%2Fmutato","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froman-koshchei%2Fmutato/lists"}