Web Vitals — Complete Guide
Web Vitals — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of React.js Tutorial on Toolliyo Academy.
On this page
React.js Tutorial · Lesson 68 of 100
Micro Frontends
Beginner ✓ → Intermediate ✓ → Advanced → Professional
Advanced · 3 — Production skills · ~18 min read · Module 7: Performance & Scaling
Introduction
This is advanced material: Micro Frontends. It is what teams use on live products. Read the example carefully and try changing one line at a time to see what happens. Micro frontends split one big frontend into smaller apps owned by different teams — each deploys independently, loaded by a shell app. Huge monolith frontends slow releases. Teams want to ship their module without redeploying the entire site.
Do not optimize early. First make it work, then measure, then fix what is actually slow.
When will you use this?
Apply when users complain the app feels slow, or Lighthouse shows red scores.
- Slow admin tables with thousands of rows need memo, lazy load, or virtualization.
- Lighthouse scores matter for public sites — clients notice slow pages.
Real-world: HR + CRM shell
Enterprise loads HR React app and CRM React app as remotes inside single shell — teams deploy independently.
Production-style code
// shell App.jsx
const HrApp = lazy(() => import('hrApp/App'));
const CrmApp = lazy(() => import('crmApp/App'));
function EnterpriseShell() {
const { section } = useParams();
return (
<Layout>
<Suspense fallback={<Spinner />}>
{section === 'hr' && <HrApp />}
{section === 'crm' && <CrmApp />}
</Suspense>
</Layout>
);
}
What happens in production: Org scale: separate repos, separate releases, shared design tokens — Module Federation or single-spa.
Lesson example (start here)
Copy this smaller example first. Once it works, compare it with the real-world code above.
// Shell loads remote at runtime (Module Federation)
remotes: {
checkout: 'checkout@https://cdn.example.com/remoteEntry.js'
}
// Shell route
const Checkout = lazy(() => import('checkout/CheckoutApp'));
Line-by-line walkthrough
| Code | What it means |
|---|---|
// Shell loads remote at runtime (Module Federation) | Comment — notes for humans; the computer ignores it. |
remotes: { | Part of the Micro Frontends example — read it together with the lines before and after. |
checkout: 'checkout@https://cdn.example.com/remoteEntry.js' | Part of the Micro Frontends example — read it together with the lines before and after. |
} | Closes a block started by { or ( above. |
// Shell route | Comment — notes for humans; the computer ignores it. |
const Checkout = lazy(() => import('checkout/CheckoutApp')); | Defines a function — often a component or event handler. |
How it works (big picture)
- Shell handles routing and shared layout.
- Remote teams publish their bundle.
- Shared react/react-dom must be single version.
Do this on your computer
- Start with modular monolith — split only when team pain is real.
- Study Module Federation or iframe boundaries.
- Agree on shared dependency versions.
- Read the real-world section and name which part of the app uses this topic.
- Run the example locally and confirm the same behavior in the browser.
- Change one value in the example (text, initial state, or URL) and predict what will happen before you save.
Experiments — try changing this
- Change text or labels in the example and save — watch the browser update.
- Break the code on purpose (remove a bracket), read the error message, then fix it.
- Open React DevTools (browser extension) while running Micro Frontends and inspect component props/state.
Remember
Split frontend by team/domain. Independent deploys. Use when org scale demands it — not by default.
Common questions
Micro frontends vs monolith?
Monolith is simpler; micro when multiple teams collide on one repo.
How long should I spend on Micro Frontends?
Until you can explain it in your own words and run the example without looking at the answer. Beginners often need 30–60 minutes per new hook or routing topic; setup lessons may take one afternoon.
What if I get stuck on Micro Frontends?
Re-read the line-by-line walkthrough, check the browser console for red errors, and compare your code character-by-character with the example. Search the exact error text — someone else had it too.
Where is Micro Frontends used in real jobs?
See the real-world section above — the same pattern appears in LMS, banking, e-commerce, and SaaS products. Interviewers ask you to explain it using one concrete example from your project or this lesson.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!