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

@mintel/mfe-react-bridge

v1.0.1

Published

This package provides utilities for rendering React microfrontends that use different versions of React, allowing you to decouple your microfrontend architecture from relying on a shared instance of React. You can import microfrontends which use a differe

Readme

mfe-react-bridge

This package provides utilities for rendering React microfrontends that use different versions of React, allowing you to decouple your microfrontend architecture from relying on a shared instance of React. You can import microfrontends which use a different version of React to the host and render them without hook errors. You can also use this approach to render microfrontends that don't use React as if they were a React component.

This package is designed to work with Module Federation and inspired by @module-federation/bridge-react.

Contents

Installation

Install the package with your preferred package manager:

pnpm add @mintel/mfe-react-bridge

The package provides type definitions, as well as a /react17 entry point for projects that have not yet upgraded to React 18+.

Usage

Exporting a remote microfrontend

import { createBridgeComponent } from "@mintel/mfe-react-bridge";
// or if you're using React 17:
import { createBridgeComponent } from "@mintel/mfe-react-bridge/react17";

// Import the React component you want to expose
import App from "./App";

export default createBridgeComponent({
  rootComponent: App,
});

Importing a remote microfrontend

import { importRemote } from 'module-federation-import-remote';
import { BridgeComponent, createRemoteComponent } from 'mfe-react-bridge';

// You can define the props your remote component expects for type safety
interface ModuleComponentProps {
  authToken: string;
}

interface RemoteBridgeComponent {
  default: () => BridgeComponent<ModuleComponentProps>;
};


// Load the remote module
const remote = await importRemote<RemoteBridgeComponent>({
  url: '/path/to/bundle',
  scope: 'SomeRemotePackage',
  module: 'App',
});

// Create the React component
const RemoteComponent = createRemoteComponent<ModuleComponentProps>({
  remote,
  // Provide an error fallback
  fallback: () => <div>Error!</div>,
});

// Render the React component
const SomeApp = () => (
  <Suspsense fallback={<div>Loading...</div>}>
    <RemoteComponent authToken="some-auth-token" />
  </Suspense>
);

How it works

This library provides a wrapper interface around React components to avoid rendering components using different instances of React within a single React tree. The library abstracts the bridge interface and allows you to work with React components, but it can be useful to understand how this works.

The createBridgeComponent function wraps an render/destroy interface around a React component:

export interface BridgeComponent<ModuleComponentProps> {
  render: (
    props: ModuleComponentProps & {
      dom: HTMLDivElement;
      fallback: (info: { error: Error }) => React.ReactElement;
    },
  ) => void;
  destroy: (params: { dom: HTMLDivElement }) => void;
}

The createRemoteComponent function takes a remote module that exports this interface and provides a React component that uses it under the hood.

If you're trying to expose a non-React microfrontend, you can implement the BridgeComponent interface directly to wrap your microfrontend's render and destroy logic:

export default () => ({
  render: ({ dom, ...props }) => {
    // Your microfrontend's render logic here
  },
  destroy: ({ dom }) => {
    // Your microfrontend's cleanup logic here
  },
});

Contributing

Contributions are welcome! Please open issues and pull requests as needed.

We're using this in production at Mintel, so any changes must be backwards compatible.