DEV Community

Alex Spinov
Alex Spinov

Posted on

Million.js Has a Free API That Most Developers Don't Know About

Million.js makes React up to 70% faster by replacing the Virtual DOM with a fine-grained compiler. Drop it into any React project with zero refactoring.

Installation

npx million@latest
Enter fullscreen mode Exit fullscreen mode

It automatically configures your bundler (Vite, Next.js, Webpack).

Automatic Mode (Zero Config)

// next.config.js
import million from "million/compiler";

export default million.next({ auto: true });
Enter fullscreen mode Exit fullscreen mode

That is it. Million.js analyzes your components and optimizes them automatically.

Block Mode (Manual Optimization)

import { block } from "million/react";

function ProfileCard({ name, avatar, bio }) {
  return (
    <div className="card">
      <img src={avatar} alt={name} />
      <h2>{name}</h2>
      <p>{bio}</p>
    </div>
  );
}

// Wrap with block() for maximum performance
export default block(ProfileCard);
Enter fullscreen mode Exit fullscreen mode

For Loops (Lists)

import { For } from "million/react";

function TodoList({ todos }) {
  return (
    <For each={todos}>
      {(todo) => <div key={todo.id}>{todo.text}</div>}
    </For>
  );
}
Enter fullscreen mode Exit fullscreen mode

How It Works

  1. Compile time: Analyzes JSX to find static parts
  2. Runtime: Only updates dynamic parts (like Svelte/Solid)
  3. Result: 70% fewer VDOM operations

Benchmarks

  • List rendering: 2-3x faster than vanilla React
  • State updates: 50-70% fewer DOM operations
  • Bundle size: +1KB gzipped

Key Features

  • Drop-in replacement — no code changes needed in auto mode
  • Fine-grained rendering — updates only changed DOM nodes
  • Works with Next.js, Vite, Webpack
  • React 18/19 compatible

Need to scrape or monitor web data at scale? Check out my web scraping actors on Apify — ready-made tools that extract data from any website in minutes. Or email me at spinov001@gmail.com for custom solutions.

Top comments (0)