kanna
v0.0.5
Published
front-end framework
Downloads
2
Readme
kanna -- A simple, composable Framework
install
npm install kanna
usage
- create HTMLElement
const {k, mount} = require('kanna');
mount(document.body, k('h1', {}, ['title']));
- component
const {k, V, mount} = require('kanna');
const comp = V(({
props
}) => {
return k('h1', {}, [props.text]);
});
mount(document.body, k(comp, {
text: 'hello'
}));
- update data
function getData() {
return Promise.resolve({
text: 'kino'
});
}
const comp = V(({
props,
}) => {
return k('h1', {}, [props.text]);
}, {
mounted: ({
props
}, {
update
}) => {
getData().then(data => {
update('text', data.text);
});
}
});
mount(document.body, k(comp, {
text: ''
}, []));
test
- unit test
npm test
- run example web
npm run server