{"id":23790063,"url":"https://github.com/blackglory/extra-react-store","last_synced_at":"2026-05-17T02:06:06.274Z","repository":{"id":181003254,"uuid":"665986020","full_name":"BlackGlory/extra-react-store","owner":"BlackGlory","description":"🌳","archived":false,"fork":false,"pushed_at":"2026-05-12T05:39:09.000Z","size":824,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-12T07:33:21.290Z","etag":null,"topics":["browser","esm","library","npm-package","react","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/extra-react-store","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/BlackGlory.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-13T12:50:37.000Z","updated_at":"2026-05-12T05:39:13.000Z","dependencies_parsed_at":"2023-12-13T05:20:36.170Z","dependency_job_id":"6d6e1651-5b7b-456f-81d3-2aac43ccd0f9","html_url":"https://github.com/BlackGlory/extra-react-store","commit_stats":null,"previous_names":["blackglory/extra-react-store"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/BlackGlory/extra-react-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-react-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-react-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-react-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-react-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlackGlory","download_url":"https://codeload.github.com/BlackGlory/extra-react-store/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fextra-react-store/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33125184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"online","status_checked_at":"2026-05-17T02:00:05.366Z","response_time":107,"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":["browser","esm","library","npm-package","react","typescript"],"created_at":"2025-01-01T17:18:16.538Z","updated_at":"2026-05-17T02:06:06.244Z","avatar_url":"https://github.com/BlackGlory.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# extra-react-store\n## Install\n```sh\nnpm install --save extra-react-store\n# or\nyarn add extra-react-store\n```\n\n## Usage\n```tsx\nimport { Draft } from 'immer'\nimport { useMemo } from 'react'\nimport { createStoreContext, Store, useSelector, useUpdater } from 'extra-react-store'\n\ninterface IState {\n  count: number\n}\n\nconst Context = createStoreContext\u003cIState\u003e()\n\nfunction App() {\n  const store = useMemo\u003cStore\u003cIState\u003e\u003e(() =\u003e new Store({ count: 0 }), [])\n\n  return (\n    \u003cContext.Provider value={store}\u003e\n      \u003cViewer /\u003e\n      \u003cController /\u003e\n    \u003c/Context.Provider\u003e\n  )\n}\n\nfunction Viewer() {\n  const count = useSelector(Context, state =\u003e state.count)\n\n  return (\n    \u003cspan\u003e{count}\u003c/span\u003e\n  )\n}\n\nfunction Controller() {\n  const update = useUpdater\u003cIState\u003e(Context)\n\n  return (\n    \u003cbutton onClick={() =\u003e update(increment(1))}\u003eIncrement\u003c/button\u003e\n  )\n}\n\nfunction increment(value: number): (state: Draft\u003cIState\u003e) =\u003e void {\n  return state =\u003e {\n    state.count += value\n  }\n}\n```\n\n## API\n```ts\nimport { Draft } from 'immer'\n\ntype StoreContext\u003cState\u003e = React.Context\u003cIStore\u003cState\u003e\u003e\n\ninterface IStore\u003cState\u003e {\n  getState(): State\n  setState(newState: State): void\n  subscribe(fn: (state: State) =\u003e void): () =\u003e void\n}\n\ntype Updater\u003cState\u003e = (...args:\n| [newState: State]\n| [fn: (draft: Draft\u003cState\u003e) =\u003e void | State]\n) =\u003e void\n```\n\n### Store\n```ts\nclass Store\u003cState\u003e implements IStore\u003cState\u003e {\n  constructor(initialState: State)\n}\n```\n\n### createStoreContext\n```ts\nfunction createStoreContext\u003cState\u003e(): StoreContext\u003cState\u003e\n```\n\n### useSelector\n```ts\nfunction useSelector\u003cState, Value\u003e(\n  context: StoreContext\u003cState\u003e\n, selector: (state: State) =\u003e Value\n, isEqual: (a: Value, b: Value) =\u003e boolean = isReferenceEqual\n): Value\n```\n\n### useUpdater\n```ts\nfunction useUpdater\u003cState\u003e(context: StoreContext\u003cState\u003e): Updater\u003cState\u003e\n```\n\n### usePartialUpdater\n```ts\nfunction usePartialUpdater\u003cState, PartialState\u003e(\n  context: StoreContext\u003cState\u003e\n, extractPartialState: (state: State) =\u003e PartialState\n, mergePartialState: (state: State, partialState: PartialState) =\u003e State\n): Updater\u003cPartialState\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackglory%2Fextra-react-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackglory%2Fextra-react-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackglory%2Fextra-react-store/lists"}