Documentation
Quickstart

Quickstart

Install Million.js

Inside your project directory, run the following command:

npm install million

Integrate into your project

Here's an example of how to use block(), which creates a reusable component, and <Block />, which renders a callback returning JSX.

App.js
import { createRoot } from 'react-dom/client';
import { block, Block } from 'million/react';
 
function Hello({ name }) {
  return <p>Hey there {name}</p>;
}
 
// You can create a block either by:
 
// 1. Creating a reusable block
const HelloBlock = block(Hello);
 
function App() {
  return <>
    {/* 2. Rendering a block inside the JSX */}
    <Block name="Million">{Hello}</Block>
 
    <HelloBlock name="Million" />
  </>;
}
 
createRoot(document.getElementById('root')).render(<App />);

Profit. 🎉