{"id":31049251,"url":"https://github.com/timbroddin/react-global-state","last_synced_at":"2025-10-29T15:32:11.231Z","repository":{"id":139337941,"uuid":"75642836","full_name":"TimBroddin/react-global-state","owner":"TimBroddin","description":"🤗 Global state for your react-components. ","archived":false,"fork":false,"pushed_at":"2016-12-05T16:19:15.000Z","size":3,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T22:16:07.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/TimBroddin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-05T16:09:05.000Z","updated_at":"2019-01-31T22:03:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"096e2ce2-941c-492e-89dd-dee282a0059b","html_url":"https://github.com/TimBroddin/react-global-state","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"8e2275029a4368e3f11cb721bb75371324e8ee54"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TimBroddin/react-global-state","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimBroddin%2Freact-global-state","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimBroddin%2Freact-global-state/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimBroddin%2Freact-global-state/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimBroddin%2Freact-global-state/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimBroddin","download_url":"https://codeload.github.com/TimBroddin/react-global-state/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimBroddin%2Freact-global-state/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281646273,"owners_count":26537258,"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-10-29T02:00:06.901Z","response_time":59,"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":"2025-09-14T21:48:37.201Z","updated_at":"2025-10-29T15:32:11.193Z","avatar_url":"https://github.com/TimBroddin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-global-state\n\nSometimes you want global state in React, but you don't want the added complexity of using Redux. What if calling `setState` could update your entire state tree?\n\n## Installation\n\n`npm install --save react-global-state`\n\nor\n\n`yarn add react-global-state`\n\n## Usage\n\nWrap your components with `gs`. Your global state will be available as the `state` and `setState` props.\n\n\timport {gs} from 'react-global-state';\n\t\n\tclass Button extends Component {\n        onClick() {\n            const {state, setState} = this.props;\n            setState({counter: (state.counter) ? state.counter+1 : 1});\n        }\n    \n        render() {\n            const {state} = this.props;\n            return \u003cdiv onClick={this.onClick.bind(this)}\u003eClick me\u003c/div\u003e\n        }\n    }\n    \n    class Display extends Component {\n        render() {\n            const {state} = this.props;\n            return \u003cdiv\u003eCounter value: {state.counter}\u003c/div\u003e\n        }\n    }\n    \n    const WrappedButton = gs(Button);\n    const WrappedDisplay = gs(Display);\n    \n    class App extends Component {\n        render() {\n            const {state} = this.props;\n            return (\n            \u003cdiv className=\"App\"\u003e\n                \u003cWrappedButton /\u003e\n                \u003cWrappedDisplay /\u003e\n            \u003c/div\u003e\n            );\n        }\n    }\n\n## Inspired by...\n\nRedux, which I love and which you should use if your app has the least bit of complexity.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimbroddin%2Freact-global-state","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimbroddin%2Freact-global-state","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimbroddin%2Freact-global-state/lists"}