2017-03-01 10:49:29 -08:00
2017-03-01 10:49:29 -08:00
🌅
2017-02-24 18:27:43 -08:00
2017-03-01 10:49:29 -08:00
🌅
2017-02-24 18:27:43 -08:00

react2angular Build Status NPM Apache2

The easiest way to use React components in Angular 1!

Installation

npm install react2angular --save

Usage

1. Create a React component

import { Component } from 'react'

interface Props {
  fooBar: number
  baz: string
}

interface State {...}

class MyComponent extends Component<Props, State> {
  render() {
    return <div>
      <p>Foo: {this.props.fooBar}</p>
      <p>Bar: {this.props.bar}</p>
    </div>
  }
  ...
}

Note: this example uses TypeScript, but it works just as well with vanilla JavaScript, ES6, Flow, etc.

2. Expose it to Angular

import { react2angular } from 'react2angular'

angular
  .module('myModule', [])
  .component('myComponent', react2angular(MyComponent, ['foo', 'bar']))

3. Use it in your Angular 1 code

<my-component
  foo-bar="3"
  baz="'foo'"
></my-component>

Tests

npm test

License

Apache2

S
Description
The easiest way to embed React components in Angular 1 apps.
Readme 2.2 MiB
Languages
TypeScript 95.3%
JavaScript 4.7%