{"id":16081958,"url":"https://github.com/jefreesujit/react-context-redux","last_synced_at":"2026-02-28T17:31:03.236Z","repository":{"id":32676344,"uuid":"139165247","full_name":"Jefreesujit/react-context-redux","owner":"Jefreesujit","description":"A Redux style wrapper over React's Context API","archived":false,"fork":false,"pushed_at":"2023-03-02T01:51:31.000Z","size":1017,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-14T06:06:21.893Z","etag":null,"topics":["context","context-api","middleware","react","redux","state","store"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-context-redux","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/Jefreesujit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-06-29T15:22:38.000Z","updated_at":"2018-12-26T14:01:50.000Z","dependencies_parsed_at":"2024-08-21T15:26:37.061Z","dependency_job_id":"0f6f8e9b-64a6-4458-8100-63d37bca070d","html_url":"https://github.com/Jefreesujit/react-context-redux","commit_stats":null,"previous_names":["jefreesujit/react-context-state"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jefreesujit%2Freact-context-redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jefreesujit%2Freact-context-redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jefreesujit%2Freact-context-redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jefreesujit%2Freact-context-redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jefreesujit","download_url":"https://codeload.github.com/Jefreesujit/react-context-redux/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694373,"owners_count":20980729,"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":["context","context-api","middleware","react","redux","state","store"],"created_at":"2024-10-09T11:24:48.321Z","updated_at":"2026-02-28T17:31:03.194Z","avatar_url":"https://github.com/Jefreesujit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-context-redux \n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]\n\nA Redux style wrapper over React's new [Context API](https://reactjs.org/docs/context.html).\n\n## Installation\n\nJust like React, react-context-redux also can be used through both `NPM` and `\u003cscript\u003e` tag\n\n```\nnpm i react-context-redux --save\n```\n\n```\n\u003cscript src=\"https://unpkg.com/react-context-redux/umd/react-context-redux.min.js\" crossorigin\u003e\u003c/script\u003e\n```\nOr use it with a specific version you need\n\n```\n\u003cscript src=\"https://unpkg.com/react-context-redux@0.3.0/umd/react-context-redux.min.js\" crossorigin\u003e\u003c/script\u003e\n```\n\n## Usage\n\nYou can use it the same way as redux provider and connect. Dispatch will be available as a prop by default when connect is used.\n\n**store.js**\n```js\nimport { createStore } from 'react-context-redux';\n\nexport const { Provider, connect } = createStore({ // pass your initial state\n  like: {\n    count: 0\n  }\n});\n```\n\nIt has middleware support too, works the same way as how redux middleware works. Just import `applyMiddleware`, include your favorite middlewares as parameters and pass it to `createStore`, and it will work like a charm.\n\n```js\nimport { createStore, applyMiddleware } from 'react-context-redux';\nimport logger from 'redux-logger';\n\nconst { Provider, connect } = createStore({someState: 'value'}, applyMiddleware(logger));\n```\n\n**App.js:**\n```js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Provider } from './store';\nimport LikeButton from './LikeButton';\n\nconst App = () =\u003e (\n  \u003cProvider\u003e\n    \u003cLikeButton /\u003e\n  \u003c/Provider\u003e\n);\n\nReactDOM.render(\u003cApp /\u003e, document.getElementById('counter_container'));\n```\n\n**LikeButton.js:**\n```js\nimport React from 'react';\nimport { connect } from './store';\n\nconst increaseCount = value =\u003e {\n  // while dispatching we expect to things two be present in the param object\n  // key - path to be updated in state ( separated by . )\n  // payload - value to be put on that path\n  // if some keys specified in the path are not available we will create them\n  return dispatch =\u003e {\n    dispatch({\n      key: 'like.count',\n      payload: value\n    });\n  };\n};\n\nconst LikeButton = ({ count, dispatch }) =\u003e (\n  \u003cbutton onClick={() =\u003e dispatch(increaseCount(count + 1))} type=\"button\"\u003e\n    {/* We have a redux-thunk like approach where you param for dispatch  is a function */}\n    Liked {count} times\n  \u003c/button\u003e\n);\n\nconst select = state =\u003e {\n  return {\n    count: state.like.count\n  };\n};\n\nexport default connect(select)(LikeButton);\n\n```\n\n`Note: While using react-context-redux through a script tag, make sure to wrap the provider`\n\n**index.js**\n```js\nclass ProviderWrapper extends React.Component {\n  render() {\n    return e(Provider, this.props);\n  }\n}\n\nReactDOM.render(\n  e(ProviderWrapper, {}, e(connect(select)(LikeButton))),\n  document.getElementById('counter_container')\n);\n```\n\n## Examples\n\nSee `/examples` folder for more examples\n\n## Contribution\n\nContributions are awesome. Go through our [Contribution Guide](CONTRIBUTING.md) to get started.\n\n\n## LICENSE\nMIT\n\n[npm-image]: https://badge.fury.io/js/react-context-redux.svg\n[npm-url]: https://npmjs.org/package/react-context-redux\n[travis-image]: https://travis-ci.org/Jefreesujit/react-context-redux.svg?branch=master\n[travis-url]: https://travis-ci.org/Jefreesujit/react-context-redux\n[daviddm-image]: https://david-dm.org/Jefreesujit/react-context-redux.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/Jefreesujit/react-context-redux\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjefreesujit%2Freact-context-redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjefreesujit%2Freact-context-redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjefreesujit%2Freact-context-redux/lists"}