{"id":23735612,"url":"https://github.com/wandri/angular-with-react-components","last_synced_at":"2026-05-08T17:36:03.677Z","repository":{"id":212107278,"uuid":"730728673","full_name":"wandri/angular-with-react-components","owner":"wandri","description":"Angular with react component","archived":false,"fork":false,"pushed_at":"2023-12-12T16:19:34.000Z","size":281,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-27T17:31:34.373Z","etag":null,"topics":["angular","components-react","react"],"latest_commit_sha":null,"homepage":"https://wandri.github.io/angular-with-react-components/","language":"TypeScript","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/wandri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-12-12T14:46:22.000Z","updated_at":"2023-12-12T15:41:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"44776d4f-87dc-454f-8014-3f06a878e7ec","html_url":"https://github.com/wandri/angular-with-react-components","commit_stats":null,"previous_names":["wandri/angular-with-react-components"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wandri/angular-with-react-components","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wandri%2Fangular-with-react-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wandri%2Fangular-with-react-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wandri%2Fangular-with-react-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wandri%2Fangular-with-react-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wandri","download_url":"https://codeload.github.com/wandri/angular-with-react-components/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wandri%2Fangular-with-react-components/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32790638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["angular","components-react","react"],"created_at":"2024-12-31T06:20:18.754Z","updated_at":"2026-05-08T17:36:03.669Z","avatar_url":"https://github.com/wandri.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular with React components\n\nA live demo is available [here](https://wandri.github.io/angular-with-react-components/)\n\n![demo](https://github.com/wandri/angular-with-react-components/assets/15016833/9b3cf9d5-5504-404b-b16a-263852a747f6)\n\nIn order to use a React component, you can follow this implementation of [react-spreadsheet](https://github.com/iddan/react-spreadsheet) example:\n\n1. Install the React packages\n\n```\nnpm i --save react react-dom\nnpm i --save-dev @types/react @types/react-dom\n```\n\n2. Allow the React files in `tsconfig.json`\n\n```json\n{\n  ...\n  \"compilerOptions\": {\n    ...\n    \"jsx\": \"react\"\n  },\n  ...\n}\n\n```\n\n3. Create your `ReactSpreadsheet.tsx` file to get the React component\n\n```tsx\nimport React, {FunctionComponent} from \"react\";\nimport Spreadsheet, {CellBase, Props} from \"react-spreadsheet\";\n\nexport const ReactSpreadsheet: FunctionComponent\u003cProps\u003cCellBase\u003e\u003e = (props: Props\u003cCellBase\u003e) =\u003e {\n  return \u003cSpreadsheet data={props.data} onActivate={props.onActivate}/\u003e\n};\n```\n\n4. Create an angular component as container, and switch the extension from `.ts` to `.tsx`\n\n```tsx\nimport {\n  AfterViewInit,\n  Component,\n  ElementRef,\n  EventEmitter,\n  Input,\n  OnChanges,\n  OnDestroy,\n  Output,\n  ViewChild\n} from '@angular/core';\nimport {createRoot, Root} from \"react-dom/client\";\nimport ReactDOM from \"react-dom\";\nimport * as React from \"react\";\nimport {ReactSpreadsheet} from \"./ReactSpreadsheet\";\n\nconst containerElementRef = \"reactComponentContainer\"\n\n@Component({\n  selector: 'app-react-component',\n  standalone: true,\n  imports: [],\n  template: `\n      \u003cdiv #${containerElementRef}\u003e\u003c/div\u003e`,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ReactComponentComponent implements OnChanges, OnDestroy, AfterViewInit {\n  @ViewChild(containerElementRef, {static: true}) containerRef!: ElementRef;\n\n  @Input() data: { value: string }[][] = [];\n  @Output() public onSelect = new EventEmitter\u003c{ row?: number, column?: number }\u003e();\n  root?: Root;\n\n  constructor() {\n    this.handleActivate = this.handleActivate.bind(this);\n  }\n\n  public handleActivate(value: { row?: number, column?: number }): void {\n    if (this.onSelect) {\n      this.onSelect.emit(value);\n      this.render();\n    }\n  }\n\n  ngOnChanges(): void {\n    this.render();\n  }\n\n  ngAfterViewInit() {\n    this.root = createRoot(this.containerRef.nativeElement);\n    this.render();\n  }\n\n  ngOnDestroy() {\n    ReactDOM.unmountComponentAtNode(this.containerRef.nativeElement);\n  }\n\n  private render() {\n    if (this.root) {\n      const {data, handleActivate} = this;\n      this.root.render(\n        \u003cReact.StrictMode\u003e\n          \u003cReactSpreadsheet\n            data={data}\n            onActivate={handleActivate}\n          /\u003e\n        \u003c/React.StrictMode\u003e\n      )\n    }\n  }\n}\n```\n\n5. Use `\u003capp-react-component/\u003e` wherever you want as a normal angular component.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwandri%2Fangular-with-react-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwandri%2Fangular-with-react-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwandri%2Fangular-with-react-components/lists"}