{"id":13452624,"url":"https://github.com/coatue-oss/react2angular","last_synced_at":"2025-05-15T04:07:34.759Z","repository":{"id":39544602,"uuid":"83097851","full_name":"coatue-oss/react2angular","owner":"coatue-oss","description":"The easiest way to embed React components in Angular 1 apps.","archived":false,"fork":false,"pushed_at":"2023-02-10T07:30:43.000Z","size":590,"stargazers_count":544,"open_issues_count":43,"forks_count":110,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-28T23:07:57.329Z","etag":null,"topics":["angular","angular1","react","reactjs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coatue-oss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-02-25T01:43:20.000Z","updated_at":"2025-03-12T16:14:58.000Z","dependencies_parsed_at":"2022-08-28T01:40:41.514Z","dependency_job_id":"f675280d-ec16-48e1-8c9e-46ec74871731","html_url":"https://github.com/coatue-oss/react2angular","commit_stats":{"total_commits":80,"total_committers":14,"mean_commits":5.714285714285714,"dds":0.4375,"last_synced_commit":"e1248f6e1d641d88c032f3c9bf3dbb5ba6480dc3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatue-oss%2Freact2angular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatue-oss%2Freact2angular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatue-oss%2Freact2angular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatue-oss%2Freact2angular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coatue-oss","download_url":"https://codeload.github.com/coatue-oss/react2angular/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251899457,"owners_count":21662016,"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":["angular","angular1","react","reactjs"],"created_at":"2024-07-31T07:01:29.537Z","updated_at":"2025-05-15T04:07:29.732Z","avatar_url":"https://github.com/coatue-oss.png","language":"TypeScript","readme":"\u003cimg alt=\"React to Angular: The easiest way to use React components in Angular 1\" src=\"https://raw.githubusercontent.com/coatue-oss/react2angular/master/logo.png\" width=\"400px\" /\u003e\n\n# react2angular [![Build Status](https://img.shields.io/circleci/project/coatue-oss/react2angular.svg?branch=master\u0026style=flat-square)](https://circleci.com/gh/coatue-oss/react2angular) [![NPM](https://img.shields.io/npm/v/react2angular.svg?style=flat-square)](https://www.npmjs.com/package/react2angular) [![Apache2](https://img.shields.io/npm/l/react2angular.svg?style=flat-square)](https://opensource.org/licenses/Apache2)\n\n\u003e The easiest way to embed React components in Angular 1 apps! (opposite of [angular2react](https://github.com/coatue-oss/angular2react))\n\n## Installation\n\n```sh\n# Using Yarn:\nyarn add react2angular react react-dom prop-types\n\n# Or, using NPM:\nnpm install react2angular react react-dom prop-types --save\n```\n\n## Usage\n\n### 1. Create a React component\n\n```js\nimport { Component } from 'react'\n\nclass MyComponent extends Component {\n  render() {\n    return \u003cdiv\u003e\n      \u003cp\u003eFooBar: {this.props.fooBar}\u003c/p\u003e\n      \u003cp\u003eBaz: {this.props.baz}\u003c/p\u003e\n    \u003c/div\u003e\n  }\n}\n```\n\n### 2. Expose it to Angular\n\n```js\nimport { react2angular } from 'react2angular'\n\nangular\n  .module('myModule', [])\n  .component('myComponent', react2angular(MyComponent, ['fooBar', 'baz']))\n```\n\nNote: If you defined [`propTypes`](https://facebook.github.io/react/docs/typechecking-with-proptypes.html) on your component, they will be used to compute component's bindings, and you can omit the 2nd argument:\n\n```js\n...\n  .component('myComponent', react2angular(MyComponent))\n```\n\nIf `propTypes` are defined and you passed in a 2nd argument, the argument will override `propTypes`.\n\n### 3. Use it in your Angular 1 code\n\n```html\n\u003cmy-component\n  foo-bar=\"3\"\n  baz=\"'baz'\"\n\u003e\u003c/my-component\u003e\n```\n\nNote: All React props are converted to AngularJS one-way bindings. If you are passing functions into your React component, they need to be passed as a function ref, rather than as an invokable expression. Keeping an existing AngularJS-style expression will result in infinite loops as the function re-evaluates on each digest loop.\n\n## Dependency Injection\n\nIt's easy to pass services/constants/etc. to your React component: just pass them in as the 3rd argument, and they will be available in your component's Props. For example:\n\n```js\nimport { Component } from 'react'\nimport { react2angular } from 'react2angular'\n\nclass MyComponent extends Component {\n  state = {\n    data: ''\n  }\n  componentDidMount() {\n    this.props.$http.get('/path').then(res =\u003e\n      this.setState({ data: res.data })\n    )\n  }\n  render() {\n    return \u003cdiv\u003e\n      { this.props.FOO }\n      { this.state.data }\n    \u003c/div\u003e\n  }\n}\n\nangular\n  .module('myModule', [])\n  .constant('FOO', 'FOO!')\n  .component('myComponent', react2angular(MyComponent, [], ['$http', 'FOO']))\n```\n\nNote: If you have an injection that matches the name of a prop, then the value will be resolved with the injection, not the prop.\n\n## Tests\n\n```sh\nnpm test\n```\n\n## License\n\nApache2\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatue-oss%2Freact2angular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoatue-oss%2Freact2angular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatue-oss%2Freact2angular/lists"}