1.0.0-alpha.19 • Published 7 years ago
@merri/nomjs v1.0.0-alpha.19
Nom.js is a DOM library that works with JSX syntax (not compatible with React components).
Project targets:
- Small size
- Be performant
- Have compact easy-to-understand syntax
- Embrace native DOM: synchronize updates without Virtual DOM
Methods
Nom exposes three methods: h, fragment and mount.
Short explanations:
his likeReact.createElement, but returns native DOM nodes.fragmentaccepts DOM nodes, strings etc. and returns a fragment.mounttakes DOM nodes or a fragment and mounts them for constant updates.
This allows to do small browser-only apps easily:
/** @jsx h */
import { h, mount } from '@merri/nomjs'
const colors = ['blue', 'red', 'gray', 'orange']
// this short example does evil mutation of `color` variable
function Component({ color }) {
return (
<div style={() => ({ backgroundColor: color, padding: '6px' })}>
<p>Hello World!</p>
<button onclick={() => color = colors[(colors.indexOf(color) + 1) % colors.length]}>
Change color
</button>
</div>
)
}
document.body.appendChild(
mount(<Component color="black" />)
)Get it
npm install --save @merri/nomjs
yarn add @merri/nomjsPlease note this lib is still in alpha so there will probably be large changes to how things work.
1.0.0-alpha.19
7 years ago
1.0.0-alpha.18
7 years ago
1.0.0-alpha.17
7 years ago
1.0.0-alpha.16
7 years ago
1.0.0-alpha.15
7 years ago
1.0.0-alpha.14
7 years ago
1.0.0-alpha.13
7 years ago
1.0.0-alpha.12
7 years ago
1.0.0-alpha.11
7 years ago
1.0.0-alpha.10
7 years ago
1.0.0-alpha.9
7 years ago
1.0.0-alpha.8
7 years ago
1.0.0-alpha.7
7 years ago
1.0.0-alpha.6
7 years ago
1.0.0-alpha.5
7 years ago
1.0.0-alpha.4
7 years ago
1.0.0-alpha.3
7 years ago
1.0.0-alpha.2
7 years ago
1.0.0-alpha.1
7 years ago
1.0.0-alpha.0
7 years ago