{"id":17462277,"url":"https://github.com/shaunevening/react-component-strategy-map","last_synced_at":"2026-04-28T11:34:30.510Z","repository":{"id":70529599,"uuid":"143576673","full_name":"ShaunEvening/react-component-strategy-map","owner":"ShaunEvening","description":"React component for rendering out components based on key value pair","archived":false,"fork":false,"pushed_at":"2018-08-05T23:16:06.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-18T13:05:38.696Z","etag":null,"topics":["react","react-typescripts","state-machine","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/ShaunEvening.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":"2018-08-05T02:13:08.000Z","updated_at":"2018-08-05T23:18:34.000Z","dependencies_parsed_at":"2023-05-16T11:15:47.653Z","dependency_job_id":null,"html_url":"https://github.com/ShaunEvening/react-component-strategy-map","commit_stats":null,"previous_names":["shaunlloyd/react-component-strategy-map","shaunevening/react-component-strategy-map"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaunEvening%2Freact-component-strategy-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaunEvening%2Freact-component-strategy-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaunEvening%2Freact-component-strategy-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShaunEvening%2Freact-component-strategy-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShaunEvening","download_url":"https://codeload.github.com/ShaunEvening/react-component-strategy-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245983863,"owners_count":20704786,"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-typescripts","state-machine","typescript"],"created_at":"2024-10-18T08:23:59.770Z","updated_at":"2026-04-28T11:34:25.469Z","avatar_url":"https://github.com/ShaunEvening.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-componet-strategy-map\n\nA react component for rendering the correct component from a strategy map based on the given key.\n\n## How to use\n\nAdd to your `package.json`:\n\n```bash\nyarn add react-component-strategy-map\n```\n\nImport and use:\n\n```ts\nimport { RenderComponentStrategy } from 'react-component-strategy-map';\n\nconst componentStrategyMap = {\n  someKey: SomeComponent,\n  someOtherKey: SomeOtherComponent,\n};\n\nconst MainComponent = () =\u003e (\n  \u003cRenderComponentStrategy\n    componentStrategy={componentStrategyMap}\n    componentKey=\"someKey\"\n    renderDefault={() =\u003e \u003cdiv\u003eRendered default\u003c/div\u003e}\n  /\u003e\n);\n```\n\n### Available Props:\n\n|       Prop        | Optional |                   Type                    | Default |                                                                 Description                                                                 |\n| :---------------: | :------: | :---------------------------------------: | :-----: | :-----------------------------------------------------------------------------------------------------------------------------------------: |\n| componentStrategy |  false   | {[key: string]: React.ComponentType\u003cany\u003e} |   {}    |                                     Map of components used to render based on the given \"componentKey\"                                      |\n|   componentKey    |  false   |                  string                   |   \"\"    |                                       key to the desired component to render from \"componentStrategy\"                                       |\n|  componentProps   |   true   |                  object                   |   {}    |                                          And object of props to spread onto the rendered component                                          |\n|   renderDefault   |   true   |         React.ComponentType\u003cany\u003e          |  null   | React component to render if \"componentKey\" does not match a key in \"componentStrategy\". If no default is given, component will return null |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaunevening%2Freact-component-strategy-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaunevening%2Freact-component-strategy-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaunevening%2Freact-component-strategy-map/lists"}