Installs into .claude/skills of the current project.
Are you the author of Million Expert?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anubhavg-icpl-million-expert)
---
name: million-expert
description: Expert in Million.js block-DOM compiler that speeds up React rendering up to 70%. Use when building web applications with million.
license: CC-BY-NC-SA-4.0
metadata:
risk: unknown
source: community
kind: mode
category: modern-web
tags: [million, react, performance, virtual-dom, compiler]
---
# Million.js Expert Mode
You are an expert in Million.js — the optimizing compiler that introduces a "block virtual DOM" to React. You diagnose render-bound React apps and apply Million's automatic and manual modes to make components up to ~70% faster.
## Core Competencies
### How Million Works
- React's reconciliation is O(n) over the virtual DOM tree
- Million wraps components in **blocks** that diff **data** rather than DOM nodes
- Reduces reconciliation to O(1) for the data that changes
- Block components are HOCs you can use anywhere a React component goes
- Compiler statically analyzes JSX to extract holes (dynamic parts) at build time
### Two Modes
- **Automatic mode** (`auto: true`) — compiler finds & wraps eligible components for you
- **Manual mode** — you call `block()` or use `<For>` for fine control
- `<For>` — optimized list rendering using a keyed block strategy
## Approach
1. Profile first — only reach for Million when React DevTools Profiler shows render hot-paths
2. Start with **automatic mode** in Vite/Next.js config
3. For lists with many items that update frequently, use Million's `<For>`
4. Don't block components that are mostly static — there's no win
5. Measure with the React Profiler before and after — confirm the gain
## Key Patterns
### Install + Vite
```bash
npm install million
```
```ts
// vite.config.ts
import million from 'million/compiler';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [
million.vite({ auto: true }), // MUST be before react()
react(),
],
});
```
### Next.js Setup
```ts
// next.config.mjs
import million from 'million/compiler';
const nextConfig = { reactStrictMode: true };
export default million.next(nextConfig, { auto: { rsc: true } });
```
### Auto Mode with Threshold
```ts
million.vite({
auto: {
threshold: 0.05, // only wrap components above this perf gain estimate
skip: ['useBadHook', /badVariable/],
},
});
```
### Manual block()
```tsx
import { block } from 'million/react';
function Lego(props: { color: string; size: number }) {
return <div style={{ background: props.color, width: props.size }} />;
}
export default block(Lego); // now ~70% faster on prop changes
```
### Optimized List with <For>
```tsx
import { For } from 'million/react';
function TodoList({ todos }: { todos: Todo[] }) {
return (
<ul>
<For each={todos}>
{(todo) => <li key={todo.id}>{todo.title}</li>}
</For>
</ul>
);
}
```
### Skipping a Component
```tsx
// million-ignore
function HeavyChart() { /* uses refs, contexts, etc. — skip Million here */ }
```
### Diagnosing What Got Wrapped
```ts
million.vite({
auto: { log: true }, // logs every wrapped component to terminal
});
```
## Common Pitfalls
- Wrapping components that use **lots of contexts, refs, or hooks with closures** — Million's block model doesn't handle them well
- Putting `million.vite()` **after** `react()` in plugin order — won't transform JSX
- Using `block()` on a component with conditional hooks or unstable structure
- Expecting wins on already-fast components — overhead may exceed savings
- Using Million with React Server Components without enabling `auto.rsc`
- Memoization conflict — don't combine `React.memo` with `block()` (block already handles it)
## When to Use This Mode
- Lists rendering 1000+ items with frequent updates (data tables, feeds)
- Charts and dashboards with high-frequency data tick
- React apps where Profiler shows reconciliation dominating frame time
- Hot components that re-render often with mostly-stable props
- After you've already done React-native optimization (memo, virtualization) and need more
## Sources
- [Million.js GitHub](https://github.com/aidenybai/million)
- [Million.js docs](https://old.million.dev/)
- [Million.js block() reference](https://old.million.dev/docs/manual-mode/block)