{"id":28220861,"url":"https://github.com/morulus/connect-context","last_synced_at":"2025-06-10T09:30:44.729Z","repository":{"id":57205688,"uuid":"90811885","full_name":"morulus/connect-context","owner":"morulus","description":"Connect/provide context to/from the stateless component","archived":false,"fork":false,"pushed_at":"2018-09-06T14:43:55.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-18T04:16:26.557Z","etag":null,"topics":[],"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/morulus.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":"2017-05-10T02:23:37.000Z","updated_at":"2017-05-21T03:00:50.000Z","dependencies_parsed_at":"2022-09-18T01:22:30.492Z","dependency_job_id":null,"html_url":"https://github.com/morulus/connect-context","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/morulus%2Fconnect-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fconnect-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fconnect-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fconnect-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morulus","download_url":"https://codeload.github.com/morulus/connect-context/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Fconnect-context/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259047887,"owners_count":22797616,"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":[],"created_at":"2025-05-18T04:16:23.982Z","updated_at":"2025-06-10T09:30:44.636Z","avatar_url":"https://github.com/morulus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"connect-context\n==\n\nConnect/provide context to/from the stateless component\n\n```js\nimport { createProvider, connectContext } from 'connect-context';\n\nconst Provider = createProvider({\n  Layout: ({ children }) =\u003e (\n    \u003cdiv class=\"your-awesome-layout\"\u003e\n      {children}\n    \u003c/div\u003e\n  ),\n});\n\nconst contextTypes = {\n  Layout: PropTypes.func.isRequired,\n};\n\nconnectContext(contextTypes)\n(({ Layout }) =\u003e (\u003cLayout\u003e\n  Hello, React!\n\u003c/Layout\u003e));\n\n// \u003cdiv class=\"your-awesome-layout\"\u003eHello, React\u003c/div\u003e\n```\n\nDocs\n----\n\n### provideContext(contextProps, [contextTypes]) : connector\n\nPrepare context connector, which can be applied on an existing component.\n\n_Params_:\n\n- `contextProps` {object|function} Context object or getChildContext function;\n  - If is a function, accepts `props`, `state` parameters.\n- `contextTypes` {object} Context types (in case of contextProps is a function)\n\n_Returns_: {function} connector\n\n### createProvider(contextProps, [contextTypes]) : Component\n\nCreate React component, which provides specified context.\n\n_Params_:\n\n- `contextProps` {object|function} Context itselfs or getChildContext function;\n  - If is a function, accepts `props`, `state` parameters.\n- `contextTypes` {object} Context types (in case of contextProps is a function)\n\n_Returns_: {function} Component\n\n### connectContext(contextTypes, mapContextToProps): connector\n\nConnect context (specified in contextTypes) to the component.\n\n_Params_:\n\n- `contextTypes` {object} Context types\n- `mapContextToProps(context, props)` {function} Map context to the props (by the defaults maps the entire context to the props)\n\n_Returns_: {function} connector\n\n### connect(contextTypes, mapAllToProps): connector\n\nDecorator for [react-redux](https://github.com/reactjs/react-redux) _connect_, which provides you with a possibility to map context to props and state to props in the same function.\n\n_Params_:\n\n- `contextTypes` {object} Context types\n- `mapAllToProps(context, state, props)` {function} Map context, state, and own props\n\n_Returns_: {function} connector\n\n__*__ Function `connect` requires `react-redux` as optional dependence. It means that if your build envelopment has no react-redux, connect function will be unreachable.\n\nAuthor\n----\n\nVladimir Kalmykov \u003cvladimirmorulus@gmail.com\u003e\n\nLicense\n----\n\nMIT, 2017\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorulus%2Fconnect-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorulus%2Fconnect-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorulus%2Fconnect-context/lists"}