{"id":13796581,"url":"https://github.com/fabiospampinato/unstated-with-containers","last_synced_at":"2025-05-13T00:31:02.513Z","repository":{"id":57386899,"uuid":"148202923","full_name":"fabiospampinato/unstated-with-containers","owner":"fabiospampinato","description":"Higher-Order Component for subscribing to containers.","archived":true,"fork":false,"pushed_at":"2018-12-06T20:06:04.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T12:39:29.456Z","etag":null,"topics":["containers","hoc","react","unstated"],"latest_commit_sha":null,"homepage":"","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/fabiospampinato.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}},"created_at":"2018-09-10T18:45:59.000Z","updated_at":"2023-12-11T16:14:08.000Z","dependencies_parsed_at":"2022-09-13T03:01:51.675Z","dependency_job_id":null,"html_url":"https://github.com/fabiospampinato/unstated-with-containers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Funstated-with-containers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Funstated-with-containers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Funstated-with-containers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Funstated-with-containers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/unstated-with-containers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225159872,"owners_count":17430200,"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":["containers","hoc","react","unstated"],"created_at":"2024-08-03T23:01:12.111Z","updated_at":"2024-11-18T10:31:28.464Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# Unstated With Containers\n\nHigher-Order Component for subscribing to containers.\n\nSimplifies your components, removing the need to constantly use the `Subscribe` component.\n\n## Install\n\n```shell\n$ npm install --save unstated-with-containers\n```\n\n## Usage\n\n```tsx\nimport * as React from 'react';\nimport {Container} from 'unstated';\nimport withContainers from 'unstated-with-containers';\n\nclass CounterContainer extends Container {\n  state = { value: 0 };\n  increment = () =\u003e {\n    this.setState({ value: this.state.value + 1 });\n  }\n  decrement = () =\u003e {\n    this.setState({ value: this.state.value - 1 });\n  }\n}\n\nconst App = withContainers ( CounterContainer )(\n  ({ containers: [counter] }) =\u003e ( // props.containers[0] === props.container\n    \u003c\u003e\n      \u003cp\u003e{counter.state.value}\u003c/p\u003e\n      \u003cbutton onClick={counter.increment.bind ( counter )}\u003eIncrement\u003c/button\u003e\n      \u003cbutton onClick={counter.decrement.bind ( counter )}\u003eDecrement\u003c/button\u003e\n    \u003c/\u003e\n  )\n);\n```\n\n## Related\n\n- **[unstated-connect2](https://github.com/fabiospampinato/unstated-connect2)**: Connect containers to components, without sacrificing performance.\n- **[unstated-hmr](https://github.com/fabiospampinato/unstated-hmr)**: Preserve containers' states across Hot-Module-Replacements.\n- **[unstated-compose](https://github.com/fabiospampinato/unstated-compose)**: Compose multiple containers into one.\n- **[unstated-compose-suspense](https://github.com/fabiospampinato/unstated-compose-suspense)**: Add suspend/unsuspend support to `unstated-compose`.\n- **[unstated-compose-suspense-middleware](https://github.com/fabiospampinato/unstated-compose-suspense-middleware)**: Add middlewares support to `unstated-compose-suspense`.\n- **[unstated-suspense](https://github.com/fabiospampinato/unstated-suspense)**: Suspend/unsuspend updates propagation from your containers.\n- **[unstated-suspense-middleware](https://github.com/fabiospampinato/unstated-suspense-middleware)**: Add middlewares support to `unstated-suspense`.\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Funstated-with-containers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Funstated-with-containers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Funstated-with-containers/lists"}