npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ember-x-react

v1.2.0

Published

The default blueprint for Embroider v2 addons.

Downloads

7

Readme

ember-x-react

Render React components inside your ember templates:

<XReact::Root>
  <XReact @component={{this.Form}} @props={{hash onSubmit=this.handleSubmit}}>
    <label for='first-name'>{{t 'my-form.first-name'}}</label>
    <XReact
      @component={{this.TextField}}
      @props={{hash id='first-name' name='first-name'}}
    />
    <XReact @component={{this.Button}} @props={{hash type='submit'}}>
      {{t 'my-form.submit'}}
    </XReact>
  </XReact>
</XReact::Root>

Features

✅ Supports nested React components and composition

✅ Supports React Context

✅ Low runtime footprint: XReact components are transformed into react components at build time !

✅ Use ember and react features together: Conditional components in a {{#if}} block, pass @tracked properties in props

✅ Supports DOM elements as children

✅ Props type safety in the template

Limitations

❌ You cannot use the yield keyword inside a XReact component

❌ You cannot have ember components inside XReact components

Compatibility

  • Ember.js v4.12 or above
  • Embroider or ember-auto-import v2

Installation

ember install ember-x-react

Setup

Add the babel plugin in your config:

Most of the transformation logic is made at build time via a babel plugin; Add the plugin in your ember-cli-build.js configuration:

new EmberApp(defaults, {
  babel: {
    plugins: [
      // ...
      require('ember-x-react').buildBabelPlugin(),
    ],
  },
});

or directly in your Babel config file if you enabled useBabelConfig: true

Update your bundler configuration to handle JSX:

if your app is using embroider with webpack, you need to tell webpack how to handle JSX:

rules: [
  // ...
  {
    test: /\.jsx/, // replace or add tsx if you use typescript
    use: {
      loader: 'babel-loader',
      options: {
        presets: [
          // Add other presets here if you need Typescript support for example
          ['@babel/preset-react', { runtime: 'automatic' }],
        ],
      },
    },
  },
];

Usage

Simple usage

import XReactRoot from 'ember-x-react/components/x-react/root';
import XReact from 'ember-x-react/components/x-react';
import MyButton from './my-button.tsx';

export default class MyForm extends Component {

  ...

  get isFormPending() {
    return this.submitTask.isPending;
  }

  <template>
    <form>
      <MyEmberDropdown />
      <XReact::Root>
        <XReact @component={{MyButton}} @props={{hash isPending=this.isFormPending}}>
          {{#if this.isFormPending}}
            Submitting ...
          {{else}}
            Submit
          {{/if}}
        </XReact>
      </XReact::Root>
    </form>
  </template>
}

What about context providers ?

The components passed to XReact can be any valid React components, this means you can just do:

<template>
  <XReact::Root>
    <XReact @component={{MyIntlProvider}}>
      <XReact @component={{FormattedMessage}} @props={{id="hello.world"}} />
    </XReact>
  </XReact::Root>
</template>

Usage with HBS templates

Create a backing component class for your HBS template, then add the React component as a property of this class:

import { MyButton } from './my-button.tsx';

export default MyEmberComponent extends Component {
  myReactButton = MyButton;
}

Then, you can render your react component by referencing the class property:

<XReact @component={{this.myReactButton}} />

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.