{"id":16908441,"url":"https://github.com/gilbarbara/simple-react-router-redux","last_synced_at":"2026-04-09T09:51:07.962Z","repository":{"id":53999283,"uuid":"156939313","full_name":"gilbarbara/simple-react-router-redux","owner":"gilbarbara","description":"Tiny redux bindings for react-router","archived":false,"fork":false,"pushed_at":"2021-03-10T13:52:47.000Z","size":473,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T03:48:11.865Z","etag":null,"topics":["react","react-router","redux"],"latest_commit_sha":null,"homepage":null,"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/gilbarbara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-10T02:17:28.000Z","updated_at":"2021-09-26T10:12:27.000Z","dependencies_parsed_at":"2022-08-13T05:50:49.743Z","dependency_job_id":null,"html_url":"https://github.com/gilbarbara/simple-react-router-redux","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbarbara%2Fsimple-react-router-redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbarbara%2Fsimple-react-router-redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbarbara%2Fsimple-react-router-redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbarbara%2Fsimple-react-router-redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilbarbara","download_url":"https://codeload.github.com/gilbarbara/simple-react-router-redux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244236102,"owners_count":20420752,"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":["react","react-router","redux"],"created_at":"2024-10-13T18:51:29.266Z","updated_at":"2025-12-31T00:04:41.188Z","avatar_url":"https://github.com/gilbarbara.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-react-router-redux\n\n[![NPM version](https://badge.fury.io/js/simple-react-router-redux.svg)](https://www.npmjs.com/package/simple-react-router-redux) [![build status](https://travis-ci.org/gilbarbara/simple-react-router-redux.svg)](https://travis-ci.org/gilbarbara/simple-react-router-redux) [![Maintainability](https://api.codeclimate.com/v1/badges/c7e42fe511b80cc25760/maintainability)](https://codeclimate.com/github/gilbarbara/simple-react-router-redux/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/2fb41194cfedcefc7358/test_coverage)](https://codeclimate.com/github/gilbarbara/simple-react-router-redux/test_coverage)\n\nRedux bindings for react-router. A tiny fork of [connected-react-router](https://github.com/supasate/connected-react-router)\n\n## Setup\n\n```bash\nnpm install simple-react-router-redux\n```\n\n## Usage\n\nSetup your own history module:\n\n```js\nimport { createBrowserHistory } from 'history';\n\nexport default createBrowserHistory();\n```\n\nAnd configure the store:\n\n```js\nimport { applyMiddleware, createStore, compose, combineReducers } from 'redux';\nimport { connectRouter, routerMiddleware } from 'simple-react-router-redux';\n\nimport rootReducer from './reducers';\nimport history from './history';\n\n// Combine your reducers with connectRouter.\nconst reducers = combineReducers({\n  ...rootReducer,\n  router: connectRouter(history),\n});\n\nconst store = createStore(\n  reducers, // root reducer with router state\n  initialState,\n  compose(\n    applyMiddleware(\n      routerMiddleware(history), // for dispatching history actions\n      // ... other middlewares ...\n    ),\n  ),\n);\n```\n\nNow just wrap your routes with ConnectedRouter with the same history module\n\n```jsx\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { Route, Switch } from 'react-router';\nimport { ConnectedRouter } from 'simple-react-router-redux';\n\nimport history from './history';\nimport store from './store';\n\nReactDOM.render(\n  \u003cProvider store={store}\u003e\n    \u003cConnectedRouter history={history}\u003e\n      \u003cdiv\u003e\n        \u003cSwitch\u003e\n          \u003cRoute exact path=\"/\" render={() =\u003e \u003cdiv\u003eMatch\u003c/div\u003e} /\u003e\n          \u003cRoute render={() =\u003e \u003cdiv\u003eMiss\u003c/div\u003e} /\u003e\n        \u003c/Switch\u003e\n      \u003c/div\u003e\n    \u003c/ConnectedRouter\u003e\n  \u003c/Provider\u003e,\n  document.getElementById('react'),\n);\n```\n\nEnjoy!\n\n## License\n\n[MIT License](./LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbarbara%2Fsimple-react-router-redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilbarbara%2Fsimple-react-router-redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbarbara%2Fsimple-react-router-redux/lists"}