{"id":16810647,"url":"https://github.com/matinzd/use-mobx-selector","last_synced_at":"2025-08-03T12:03:38.579Z","repository":{"id":65696260,"uuid":"597188664","full_name":"matinzd/use-mobx-selector","owner":"matinzd","description":"Mobx store selector utility for react","archived":false,"fork":false,"pushed_at":"2023-02-03T21:50:38.000Z","size":110,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T21:05:57.249Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matinzd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-02-03T20:33:02.000Z","updated_at":"2023-02-03T21:24:52.000Z","dependencies_parsed_at":"2023-02-18T11:17:42.944Z","dependency_job_id":null,"html_url":"https://github.com/matinzd/use-mobx-selector","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/matinzd/use-mobx-selector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matinzd%2Fuse-mobx-selector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matinzd%2Fuse-mobx-selector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matinzd%2Fuse-mobx-selector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matinzd%2Fuse-mobx-selector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matinzd","download_url":"https://codeload.github.com/matinzd/use-mobx-selector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matinzd%2Fuse-mobx-selector/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267982184,"owners_count":24175815,"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-07-31T02:00:08.723Z","response_time":66,"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":[],"created_at":"2024-10-13T10:16:11.849Z","updated_at":"2025-08-03T12:03:38.521Z","avatar_url":"https://github.com/matinzd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MobX Selector\n\nA library that provides a hook to bind a MobX store to a React component.\n\n## Installation\n\n```\nyarn add use-mobx-selector\n```\n\n## Usage\n\n```javascript\nimport { makeAutoObservable } from \"mobx\";\nimport { useMobxSelector } from \"use-mobx-selector\";\n\nclass MobxStore {\n    ids: string[] = []\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n}\n\nconst store = new MobxStore()\n\nconst Component = (props) =\u003e {\n  const isFooAvailable = useMobxSelector(store, (store) =\u003e store.ids.includes('foo'));\n\n  return (\n    \u003cdiv\u003e\n      {isFooAvailable}\n    \u003c/div\u003e\n  );\n};\n```\n\n## API\n\n`useMobxSelector(store, selector, equalityFn?)`\n\nA hook that binds the `store` to the component and re-renders the component when the result of the `selector` function changes.\n\n### Arguments\n\n- `store`: A MobX store object.\n- `selector`: A function that takes the store as an argument and returns the selected data.\n- `equalityFn` (optional): A function that takes the previous selected data and the next selected data, and returns true if they are equal. If not provided, it will use reference equality.\n\n### Returns\n\nThe selected data returned from the selector function.\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatinzd%2Fuse-mobx-selector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatinzd%2Fuse-mobx-selector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatinzd%2Fuse-mobx-selector/lists"}