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

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

via Dev.to ReactAlex Spinov

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 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 }); 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 ); For Loops (Lists) import { For } from " million/react " ; function TodoList ({ todos }) { return ( < For each = { todos } > {( todo ) => < div key = { todo . id } > { todo . text }

Continue reading on Dev.to React

Opens in a new tab

Read Full Article
8 views

Related Articles