{"id":19040223,"url":"https://github.com/logisticinfotech/easiest-demo-redux-reactjs","last_synced_at":"2026-02-26T21:46:19.738Z","repository":{"id":97376346,"uuid":"145020699","full_name":"logisticinfotech/easiest-demo-redux-reactjs","owner":"logisticinfotech","description":"Easiest demo of redux in reacjs with little ui state management","archived":false,"fork":false,"pushed_at":"2018-08-22T11:55:23.000Z","size":87,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-07T02:43:08.545Z","etag":null,"topics":["demo","demo-app","html","react-redux","react-redux-demo","reactjs","redux","tutorial"],"latest_commit_sha":null,"homepage":"https://www.logisticinfotech.com/blog/easiest-demo-to-learn-redux-in-reactjs-with-code-example/","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/logisticinfotech.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":"2018-08-16T17:40:36.000Z","updated_at":"2024-07-19T04:28:45.000Z","dependencies_parsed_at":"2023-03-22T22:31:01.422Z","dependency_job_id":null,"html_url":"https://github.com/logisticinfotech/easiest-demo-redux-reactjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/logisticinfotech/easiest-demo-redux-reactjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logisticinfotech%2Feasiest-demo-redux-reactjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logisticinfotech%2Feasiest-demo-redux-reactjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logisticinfotech%2Feasiest-demo-redux-reactjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logisticinfotech%2Feasiest-demo-redux-reactjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logisticinfotech","download_url":"https://codeload.github.com/logisticinfotech/easiest-demo-redux-reactjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logisticinfotech%2Feasiest-demo-redux-reactjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29873651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T21:05:00.265Z","status":"ssl_error","status_checked_at":"2026-02-26T20:57:13.669Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["demo","demo-app","html","react-redux","react-redux-demo","reactjs","redux","tutorial"],"created_at":"2024-11-08T22:21:14.961Z","updated_at":"2026-02-26T21:46:19.720Z","avatar_url":"https://github.com/logisticinfotech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easiest React Redux Demo with little UI state managment like tab, input, select, checkbox, radio\n\nPurpose of this demo is to understand redux easily. You can find step by step guide [here](https://www.logisticinfotech.com/blog/easiest-demo-to-learn-redux-in-reactjs-with-code-example/) to understand this demo properly.\n\n## React Redux configuration\n\nFirst install `react-redux`\n```\nnpm install react-redux --save\n```\n\nNow, you need to define provider and store in index.js\n\n```\nimport { Provider } from 'react-redux';\nimport { store } from './reducers';\n\nReactDOM.render(\n    \u003cProvider store={store}\u003e\n        \u003cApp /\u003e\n    \u003c/Provider\u003e,\n    document.getElementById('root')\n);\n```\n\nNow, we need to create two files :\n\n1) action/index.js\n\n```\nexport const tabClicked = (activeTab) =\u003e ({\n    type: 'tabClicked',\n    activeTab: activeTab\n});\n```\n\n2) reducers/index.js\n\n```\nimport { combineReducers, createStore } from 'redux';\n\n// Initial State\nconst initialState = {\n    activeTab: 1\n}\n\n// reducers part\nexport const actionReducer = (state = initialState, action) =\u003e {\n    switch (action.type) {\n        case 'tabClicked':\n            return {\n                ...state,\n                activeTab: action.activeTab\n            }\n        default:\n            return state;\n    }\n};\n\n\nexport const reducers = combineReducers({\n    actionReducer\n});\n\n// store part\nexport const store = createStore(reducers);\n```\n\n## How to use in component\n\n```\nimport { tabClicked } from './../../actions';\n\nclass uplicateTabComponent extends Component {\n    render() {\n        return (\n            \u003cdiv\u003e\n            \u003c/div\u003e\n        );\n    }\n}\n\nfunction mapStateToProps(state) {\n    return {\n        activeTab: state.actionReducer.activeTab,\n    }\n}\n\nconst mapDispatchToProps = {\n    tabClicked\n};\n\nconst TabContainer = connect(\n    mapStateToProps,\n    mapDispatchToProps\n)(TabComponent);\n```\n\nWe can use props and event in html. You just need to put html in redner function in component.\n\n```\n\u003ca className={\"nav-item nav-link\" + (this.props.activeTab === 1 ? ' active' : '')} id=\"nav-tab1-tab\" data-toggle=\"tab\" href=\"#nav-tab1\" role=\"tab\" aria-controls=\"nav-tab1\" aria-selected=\"true\" onClick={() =\u003e this.props.tabClicked(1)}\u003eTab 1\u003c/a\u003e\n```\n\n## Development server\n\nRun `npm start` for a dev server. Navigate to `http://localhost:3000/`. The app will automatically reload if you change any of the source files.\n\n\n## Further help\n\nCheckout full blog [here](https://www.logisticinfotech.com/blog/easiest-demo-to-learn-redux-in-reactjs-with-code-example/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogisticinfotech%2Feasiest-demo-redux-reactjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogisticinfotech%2Feasiest-demo-redux-reactjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogisticinfotech%2Feasiest-demo-redux-reactjs/lists"}