{"id":15854319,"url":"https://github.com/afeiship/next-react-valtio","last_synced_at":"2026-05-09T15:16:52.041Z","repository":{"id":218145549,"uuid":"745721130","full_name":"afeiship/next-react-valtio","owner":"afeiship","description":"Valtio for react.","archived":false,"fork":false,"pushed_at":"2024-02-23T00:50:59.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T12:31:43.687Z","etag":null,"topics":["computed","derived","getters","next","proxy","react","state","store","val","valtio"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/afeiship.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2024-01-20T00:27:21.000Z","updated_at":"2024-04-17T04:47:33.000Z","dependencies_parsed_at":"2024-01-20T02:11:33.074Z","dependency_job_id":"96cf2f0d-0f69-4bed-88e5-a16674dcbd0c","html_url":"https://github.com/afeiship/next-react-valtio","commit_stats":null,"previous_names":["afeiship/next-react-valtio"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-react-valtio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-react-valtio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-react-valtio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fnext-react-valtio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afeiship","download_url":"https://codeload.github.com/afeiship/next-react-valtio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246698172,"owners_count":20819506,"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","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":["computed","derived","getters","next","proxy","react","state","store","val","valtio"],"created_at":"2024-10-05T19:41:32.322Z","updated_at":"2026-05-09T15:16:52.035Z","avatar_url":"https://github.com/afeiship.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# next-react-valtio\n\u003e Valtio for react.\n\n[![version][version-image]][version-url]\n[![license][license-image]][license-url]\n[![size][size-image]][size-url]\n[![download][download-image]][download-url]\n\n## installation\n```bash\nyarn add valtio derive-valtio\nyarn add @jswork/create-valtio-state\nyarn add @jswork/next-react-valtio\n```\n\n## usage\n```js\nimport '@jswork/next-react-valtio';\n```\n\n```jsx\nconst InteractiveList = () =\u003e {\n  const getters = {\n    size: (state) =\u003e state.length\n  };\n  const { state, store, computed } = nx.$valtio\u003cnumber[]\u003e([1, 2, 3, 4], getters);\n  return (\n    \u003cdiv className=\"bg-slate-100 p-2\"\u003e\n      \u003ch1\u003eVite + React\u003c/h1\u003e\n      \u003cnav className=\"mt-4 flex gap-1 border border-solid p-1\"\u003e\n        \u003cbutton onClick={() =\u003e store.push(state.length + 1)}\u003e添加\u003c/button\u003e\n        \u003cbutton\n          onClick={() =\u003e {\n            store.splice(0, state.length, ...['a', 'b', 'c', 'd', 'e']);\n          }}\u003e\n          Reset\n        \u003c/button\u003e\n      \u003c/nav\u003e\n      {state.map((item, index) =\u003e (\n        \u003cdiv className=\"m-2 block border\" key={index}\u003e\n          \u003cspan className=\"bold mr-1\"\u003e{item}\u003c/span\u003e\n          \u003cbutton onClick={() =\u003e store.splice(index, 1)}\u003e删除\u003c/button\u003e\n        \u003c/div\u003e\n      ))}\n      {state.length === 0 \u0026\u0026 \u003cdiv className=\"m-2 block border\"\u003e暂无数据\u003c/div\u003e}\n    \u003c/div\u003e\n  );\n};\n\nexport default InteractiveList;\n```\n\n## api\n- `nx.$valtio(initialState, getters)`: create a valtio store with initialState and getters.\n- `nx.$defineProxy(initialState)`: create a valtio proxy with initialState.\n- `nx.$useProxy(store)`: create a valtio proxy with store.\n- `nx.$useStore(initialState)`: create a valtio store with initialState.\n\n## license\nCode released under [the MIT license](https://github.com/afeiship/next-react-valtio/blob/master/LICENSE.txt).\n\n[version-image]: https://img.shields.io/npm/v/@jswork/next-react-valtio\n[version-url]: https://npmjs.org/package/@jswork/next-react-valtio\n\n[license-image]: https://img.shields.io/npm/l/@jswork/next-react-valtio\n[license-url]: https://github.com/afeiship/next-react-valtio/blob/master/LICENSE.txt\n\n[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-react-valtio\n[size-url]: https://github.com/afeiship/next-react-valtio/blob/master/dist/next-react-valtio.min.js\n\n[download-image]: https://img.shields.io/npm/dm/@jswork/next-react-valtio\n[download-url]: https://www.npmjs.com/package/@jswork/next-react-valtio\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fnext-react-valtio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafeiship%2Fnext-react-valtio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fnext-react-valtio/lists"}