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

@memberjunction/ng-react

v5.11.0

Published

Angular components for hosting React components in MemberJunction applications

Downloads

3,096

Readme

@memberjunction/ng-react

An Angular integration library for rendering React components inside Angular applications. Provides a bridge component, script loader, and debugging tools for embedding React-based UI within the MemberJunction Angular ecosystem.

Installation

npm install @memberjunction/ng-react

Overview

This package provides a seamless bridge between Angular and React, allowing React components to be loaded and rendered within Angular templates. It handles React and ReactDOM script loading, Babel transpilation of JSX, component lifecycle management, and two-way communication between the Angular host and React guest.

flowchart TD
    subgraph Angular["Angular Host"]
        A["MJReactComponent"] -->|Props| B["ReactBridgeService"]
    end
    subgraph Bridge["Bridge Layer"]
        B --> C["ScriptLoaderService"]
        C --> D["Load React + ReactDOM + Babel"]
        B --> E["AngularAdapterService"]
    end
    subgraph React["React Guest"]
        D --> F["React Component"]
        F -->|Events| E
        E -->|Callbacks| A
    end

    style Angular fill:#2d6a9f,stroke:#1a4971,color:#fff
    style Bridge fill:#7c5295,stroke:#563a6b,color:#fff
    style React fill:#2d8659,stroke:#1a5c3a,color:#fff

Usage

Module Import

import { ReactModule } from '@memberjunction/ng-react';

@NgModule({
  imports: [ReactModule]
})
export class YourModule {}

Basic React Component Rendering

<mj-react-component
  [ComponentCode]="reactComponentCode"
  [Props]="componentProps"
  (ComponentEvent)="handleReactEvent($event)"
  (StateChange)="handleStateChange($event)"
  (ComponentError)="handleError($event)">
</mj-react-component>

Providing React Code

reactComponentCode = `
  function MyComponent({ title, onAction }) {
    const [count, setCount] = React.useState(0);
    return (
      <div>
        <h2>{title}</h2>
        <p>Count: {count}</p>
        <button onClick={() => setCount(c => c + 1)}>Increment</button>
        <button onClick={() => onAction('submit')}>Submit</button>
      </div>
    );
  }
`;

componentProps = {
  title: 'My React Widget',
  onAction: (action: string) => console.log('React action:', action)
};

Components

| Component | Selector | Purpose | |-----------|----------|---------| | MJReactComponent | mj-react-component | Renders a React component inside Angular |

MJReactComponent Inputs

| Property | Type | Default | Description | |----------|------|---------|-------------| | ComponentCode | string | '' | JSX/React code to transpile and render | | Props | Record<string, unknown> | {} | Props passed to the React component | | EnableDebug | boolean | false | Enable debug logging |

MJReactComponent Outputs

| Event | Type | Description | |-------|------|-------------| | ComponentEvent | EventEmitter<ReactComponentEvent> | Custom events from the React component | | StateChange | EventEmitter<StateChangeEvent> | React component state changes | | ComponentError | EventEmitter<Error> | Errors during rendering or transpilation | | ComponentReady | EventEmitter<void> | React component has mounted |

Services

| Service | Purpose | |---------|---------| | ScriptLoaderService | Loads React, ReactDOM, and Babel from CDN with caching | | ReactBridgeService | Manages React component lifecycle and prop synchronization | | AngularAdapterService | Provides Angular context (router, DI) to React components |

Configuration

Debug Configuration

import { ReactDebugConfig } from '@memberjunction/ng-react';

// Enable verbose logging for development
ReactDebugConfig.enabled = true;
ReactDebugConfig.logLevel = 'verbose';

How It Works

  1. ScriptLoaderService loads React, ReactDOM, and Babel scripts if not already present
  2. The React component code (JSX string) is transpiled using Babel in the browser
  3. ReactBridgeService creates a React root and renders the component into a DOM container
  4. Props from Angular are passed to React; events from React are forwarded to Angular
  5. On Angular component destruction, the React tree is properly unmounted

Dependencies

  • @memberjunction/global -- Global utilities
  • React and ReactDOM (loaded at runtime from CDN)
  • Babel standalone (loaded at runtime for JSX transpilation)