7

Github GitHub - millionjs/million: 🌈 <1kb virtual DOM - it's fast!

 3 years ago
source link: https://github.com/millionjs/million
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

<1kb virtual DOM - it's fast!

Current Virtual DOM implementations are too complicated—Whether it be a fully featured yet bloated Virtual DOM in React, or the deprecated virtual-dom package on NPM, they are basically unusable without sacrificing raw performance and size. Million aims to do this, providing a library-agnostic Virtual DOM to serve as the core for Javascript libraries.

Installing Million

Million doesn't require build tools by default, feel free to just drop a script tag in the head of your webpage.

<script src="https://unpkg.com/million"></script>

It also integrates well with module bundlers like Webpack or Rollup, just install via npm.

Hello World Example

Below is an extremely simple implementation of a Hello World page using Million.

<div id="app"></div>

<script>
  const { m, patch } = Million;
  const newVNode = m('div', { id: 'app' }, ['Hello World']);
  const el = document.querySelector('#app');
  patch(newVNode, el);
</script>

Resources & Contributing Back

Have a question about Million? Post it on the GitHub Discussions and ask the community for help.

Find a bug? Head over to our issue tracker and we'll do our best to help. We love pull requests, too!

Acknowledgments

Million is MIT-licensed open-source software by Aiden Bai, William Lane et al.

Million takes heavy inspiration from React, and believes in the core philosophies and values behind Lucia and Inferno. Feel free to check them out if you interested in an alternative library to use.


© 2020-2021 Aiden Bai, William Lane.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK