MCPcopy Index your code
hub / github.com/alexlafroscia/ember-react-components

github.com/alexlafroscia/ember-react-components @v3.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.2 ↗ · + Follow
51 symbols 102 edges 37 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ember-react-components

Build Status

Consume React components in Ember

This addon is a proof-of-concept for an approach to rendering React components in Ember. It is almost entirely inspired by a blog post by Sivakumar Kailasam, from which the general idea was borrowed.

Installation

ember install ember-react-components @ember-decorators/babel-transforms

Compatibility

This addon requires Ember CLI 2.15 or higher.

Usage

This addon provides an ES6 class decorator that allows a React element to be rendered in Ember.

As an example, you can create a component like this:

// app/components/my-react-component.js
import React from 'react';
import WithEmberSupport from 'ember-react-components';

@WithEmberSupport
export default class extends React.Component {
  render() {
    const { name } = this.props;

    return (


Hello, {name}


    );
  }
}

And render it like this:

{{my-react-component name='Alex'}}

That would create a component that renders Hello, Alex.

Options

  • outputFile option imports react and react-dom into a separate file than /assets/vendor.js. This is useful if your entire Ember application doesn't require react. The separate file containing react and react-dom can be imported via a template or initializer.
// ember-cli-build.js
let app = new EmberApp(defaults, {
  'ember-react-components': {
    outputFile: '/assets/react.js'
  }
});

What all is this addon doing?

  • Provides imports for react and react-dom
  • Hooks up a bunch of necessary babel transforms
  • Provides a decorator for creating a thin wrapper around your React components that bridge the gap between the two libraries

Is this production ready?

It does work, but you should be really careful about including both the Ember and React libraries in your application since that's quite a lot of JavaScript to ship to your users.

License

This project is licensed under the MIT License.

Core symbols most depended-on inside this repo

wrapReactComponent
called by 2
addon/index.js
mountElement
called by 2
addon/index.js
WithEmberSupport
called by 2
addon/index.js
requireTransform
called by 1
lib/configure-jsx-transform.js
getPropsForReact
called by 1
addon/index.js
ensureMapHasOwner
called by 1
addon/-private/grant-owner-access.js
grantOwnerAccess
called by 1
addon/-private/grant-owner-access.js
componentIsFunctional
called by 1
addon/-private/component-is-functional.js

Shape

Class 22
Method 16
Function 13

Languages

TypeScript100%

Modules by API surface

addon/index.js10 symbols
addon/-private/grant-owner-access.js5 symbols
tests/dummy/app/components/set-state.js4 symbols
addon/-private/yield-wrapper.js4 symbols
tests/dummy/app/components/yield-to-children.js3 symbols
tests/dummy/app/components/with-properties.js3 symbols
tests/dummy/app/components/using-service.js3 symbols
tests/dummy/app/components/invoke-action.js3 symbols
tests/dummy/app/components/basic-component.js3 symbols
blueprints/react-component/files/app/components/__name__.js3 symbols
tests/dummy/app/router.js2 symbols
config/addon-docs.js2 symbols

For agents

$ claude mcp add ember-react-components \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page