# angular2react [](https://circleci.com/gh/coatue-oss/angular2react) [](https://www.npmjs.com/package/angular2react) [](https://opensource.org/licenses/Apache2)
> One line of code to turn any Angular 1 Component into a React Component (opposite of [react2angular](https://github.com/coatue-oss/react2angular))
## Installation
```sh
# Using Yarn:
yarn add angular2react angular angular-resource react react-dom @types/angular @types/react @types/react-dom
# Or, using NPM:
npm install angular2react angular angular-resource react react-dom @types/angular @types/react @types/react-dom --save
```
## Usage
### 1. Save a reference to the `$injector`
```js
let $injector
angular
.module('myModule')
.run(['$injector', function(_$injector) { $injector = _$injector }])
```
### 2. Create an Angular component
```js
const MyComponent = {
bindings: {
fooBar: '<',
baz: '<'
},
template: `
FooBar: {this.$ctrl.fooBar}
Baz: {this.$ctrl.baz}
` } ``` ### 3. Expose it to Angular ```js angular .module('myModule', []) .component('myComponent', MyComponent) ``` ### 4. Convert it to a React Component ```js import { angular2react } from 'angular2react' const MyComponent = angular2react('myComponent', MyComponent, $injector) ``` ### 5. Use it in your React code ```js