New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@appshell/react-federated-component

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appshell/react-federated-component

React utilities for loading federated components

latest
Source
npmnpm
Version
0.1.0-alpha.5
Version published
Maintainers
1
Created
Source
appshell

Appshell CI

@appshell/react-federated-component

React utilites for dynamically loading federated components for Webpack Module federation micro-frontends.

Working examples can be found here.

Getting Started

To begin, you'll need to install @appshell/react-federated-component:

npm install @appshell/react-federated-component --save-dev

or

yarn add -D @appshell/react-federated-component

or

pnpm add -D @appshell/react-federated-component

FederatedComponent

React component that dynamically loads federated components.

import { FederatedComponent, ManifestProvider } from '@appshell/react-federated-component';

<App>
  <ManifestProvider manifest={manifest}>
    <FederatedComponent remote="PingModule/Ping">
    <FederatedComponent remote="PongModule/Pong">
  </ManifestProvider>
</App>

useManifest

For access to the manifest.

import { ManifestProvider, useManifest } from '@appshell/react-federated-component';

const MyComponent = () => {
  const manifest = useManifest();

  ...
}

<ManifestProvider manifest={manifest}>
  <MyComponent />
</ManifestProvider>

jsonResource

Helper function for loading json resources in React Suspense components.

import { jsonResource } from '@appshell/react-federated-component';

const resource = jsonResource('http://test.com/appshell.manifest.json');

const MyComponent = () => {
  const value = resource.read();

  if (!value) {
    return null;
  }

  if (isError(value)) {
    return <ErrorMessage message={`${value}`} />;
  }

  return <div>my component</div>;
};

<React.Suspense fallback="Loading...">
  <MyComponent />
</React.Suspense>;

Where does the manifest come from?

See @appshell/cli

appshell generate manifest --configsDir appshell_configs

Keywords

webpack

FAQs

Package last updated on 10 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts