Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.38 KB

RECOMMENDATIONS.md

File metadata and controls

36 lines (23 loc) · 1.38 KB

Recommendations

Avoid CSS overrides

Use CSS-modules to avoid CSS overrides. It's also possible to prefix css classes with postcss-prefix-selector.

Isolate errors

Isolate errors with an Error boundary in the Shell app.

import Microfrontend from "https://microfrontend.com/bundle.js";

<ErrorBoundary>
  <Microfrontend />
</ErrorBoundary>;

Suspense

Show loading indicators with Suspense.

import React from "react";
import Microfrontend from "https://microfrontend.com/bundle.js";

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

Sharing state

It's possible to share state with something like nanoevents, postMessage() or sessionStorage. The nanoevents instance has to be the same across applications, so import it from esm.sh.

Keep in mind that sharing state is something that should be avoided as much as possible, because it introduces tighter coupling between applications.