JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q4298F
  • License MIT

1 KB JavaScript Virtual DOM builder and patch function.

Package Exports

  • picodom
  • picodom/src

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (picodom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Picodom

Travis CI Codecov npm

Picodom is a 1 KB Virtual DOM builder and patch function.

Try it online

import { h, patch } from "picodom"

let element, oldNode

function render(newNode) {
  return (element = patch(
    document.body,
    element,
    oldNode,
    (oldNode = newNode)
  ))
}

function view(state) {
  return (
    <div>
      <h1>{state}</h1>
      <input
        autofocus
        type="text"
        value={state}
        oninput={e => render(view(e.target.value))}
      />
    </div>
  )
}

render(view("Hello!"))

Picodom supports keyed updates & lifecycle events — all with no dependencies. Mix it with your favorite state management library and roll your own custom view framework.

License

Picodom is MIT licensed. See LICENSE.