2017-12-07 10:24:16 +09:00
2017-03-01 10:49:29 -08:00
2017-03-10 11:22:31 -08:00
2017-03-01 10:49:29 -08:00
🌅
2017-02-24 18:27:43 -08:00
2017-03-02 16:07:35 -08:00
2017-03-02 16:07:35 -08:00
2017-08-31 23:05:04 -07:00
2017-09-26 11:26:05 -07:00
2017-04-27 18:03:04 -07:00
🌅
2017-02-24 18:27:43 -08:00

React to Angular: The easiest way to use React components in Angular 1

react2angular Build Status NPM Apache2

The easiest way to embed React components in Angular 1 apps! (opposite of angular2react)

Installation

# Using Yarn:
yarn add react2angular react react-dom prop-types

# Or, using NPM:
npm install react2angular react react-dom prop-types --save

Usage

1. Create a React component

import { Component } from 'react'

class MyComponent extends Component {
  render() {
    return <div>
      <p>FooBar: {this.props.fooBar}</p>
      <p>Baz: {this.props.baz}</p>
    </div>
  }
}

2. Expose it to Angular

import { react2angular } from 'react2angular'

angular
  .module('myModule', [])
  .component('myComponent', react2angular(MyComponent, ['fooBar', 'baz']))

Note: If you defined propTypes on your component, they will be used to compute component's bindings, and you can omit the 2nd argument:

...
  .component('myComponent', react2angular(MyComponent))

If propTypes are defined and you passed in a 2nd argument, the argument will override propTypes.

3. Use it in your Angular 1 code

<my-component
  foo-bar="3"
  baz="'baz'"
></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%