Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import deepmerge from 'deepmerge';
- class VDomWrapper {
- constructor(vnode, rootElem) {
- this.vnode = vnode;
- this.rootElem = rootElem;
- this.elem;
- }
- render(attributes) {
- deepmerge(this.vnode.attributes, attributes);
- this.elem = preact.render(this.vnode, this.rootElem, this.elem);
- }
- }
- // Example:
- const foo = new VDomWrapper(<Foo str="bar" />, document.querySelector('.js-foo'));
- foo.render({ str: 'baz' });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement