{"id":13492994,"url":"https://github.com/linkmesrl/react-redux-plugin","last_synced_at":"2026-02-19T22:37:51.216Z","repository":{"id":93934886,"uuid":"58209157","full_name":"linkmesrl/react-redux-plugin","owner":"linkmesrl","description":"Proof of concept for a react + redux plugin structured app","archived":false,"fork":false,"pushed_at":"2016-05-24T08:11:42.000Z","size":33,"stargazers_count":17,"open_issues_count":2,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-01T19:45:41.079Z","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/linkmesrl.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}},"created_at":"2016-05-06T13:27:38.000Z","updated_at":"2019-06-19T09:33:54.000Z","dependencies_parsed_at":"2023-05-23T10:15:47.738Z","dependency_job_id":null,"html_url":"https://github.com/linkmesrl/react-redux-plugin","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/linkmesrl%2Freact-redux-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkmesrl%2Freact-redux-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkmesrl%2Freact-redux-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkmesrl%2Freact-redux-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linkmesrl","download_url":"https://codeload.github.com/linkmesrl/react-redux-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222376246,"owners_count":16974312,"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":"2024-07-31T19:01:11.177Z","updated_at":"2026-02-19T22:37:51.185Z","avatar_url":"https://github.com/linkmesrl.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# React redux plugin POC\n\nA proof of concept for a React application that demonstrates a simple plugin system that allows components to have a dynamic list of child components.\n\nA plugin is just a collection of components that implement a specific functionality.\n\n\n## What's inside\n\n- [x] [Webpack](https://webpack.github.io)\n- [x] [React](https://facebook.github.io/react/)\n- [x] [Redux](https://github.com/reactjs/redux)\n- [x] [Babel](https://babeljs.io/)\n\n## Setup\n\n```\n$ npm install\n```\n\n## Running\n\n```\n$ npm start\n```\n\n## How does it work\n\nA plugin is installed as a generic npm package. However we still have to mark them as plugins in order for this to work.\nThis is accomplished by listing them in a custom array inside the package.json file.\n\n```javascript\n\"plugins\": [\n  \"Settings\",\n  \"Clients\",\n  \"Maps\"\n],\n```\n\nWebpack reads the array with plugins and set constant *EXTERNAL_PLUGINS* to make them available in the app flow.\n\n```javascript\nnew webpack.DefinePlugin({\n  EXTERNAL_PLUGINS: JSON.stringify(require(\"./package.json\").plugins)\n})\n```\n\n### Plugin bootstrapping\n\nThe *App* root component dynamically requires all defined plugins during the boot phase\n```javascript\nconst plugins = EXTERNAL_PLUGINS.map(plugin =\u003e {\n  return require('PATH_TO_PLUGIN/' + plugin + '/settings.js')\n});\n```\n\nAnd saves them in the redux store via a custom action\n```javascript\nactions.addPlugins(plugins);\n```\nEvery plugin it has a file `settings.js` where all dependencies are declared.\nFor example Maps plugin it will be an array of object with component and path properties.\n\n```javascript\nimport MapsDashboards from './dashboard'\nimport MapsMain from './main'\nimport MapsMenu from './index'\n\nexport const components = [{\n  component: MapsDashboards,\n  path: 'dashboard',\n}, {\n  component: MapsMain,\n  path: 'main',\n}, {\n  component: MapsMenu,\n  path: 'menu',\n}];\n```\n\nIt will be the component itself to load plugins' components tagged for it.\n\n*SideBar* will load plugins tagged with 'menu' in path and it will create a dynamic menu.\n\n*Dashboard* is a plugin itself but it can load plugins' components tagged with 'dashboard' in path and generate a dynamic list of widgets.\n\nIn this POC every plugins have a menu item with an `onClick` handler that show a component associated in the *MainSection*. They can have also a widget that it'll be loaded in *Dashboard*.\n\n## Plugin's Lazy Loading\n\nUsing Webpack [**bundle-loader**](https://github.com/webpack/bundle-loader) is it possible to load plugins dynamically in a different bundle.\n\n```javascript\nconst waitForChunk = require('bundle?lazy!PATH_TO_PLUGIN/Orders/settings.js')\n\nwaitForChunk((file) =\u003e {\n  const newPlugin = file.components\n  actions.addPlugins(newPlugin);\n});\n```\n\nIn this example you can click on the Add Order button to load a new bundle that import a new menu item with its child.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkmesrl%2Freact-redux-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinkmesrl%2Freact-redux-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkmesrl%2Freact-redux-plugin/lists"}