Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import deepmerge from 'deepmerge';
  2.  
  3. class VDomWrapper {
  4.  
  5. constructor(vnode, rootElem) {
  6. this.vnode = vnode;
  7. this.rootElem = rootElem;
  8. this.elem;
  9. }
  10.  
  11. render(attributes) {
  12. deepmerge(this.vnode.attributes, attributes);
  13. this.elem = preact.render(this.vnode, this.rootElem, this.elem);
  14. }
  15.  
  16. }
  17.  
  18. // Example:
  19. const foo = new VDomWrapper(<Foo str="bar" />, document.querySelector('.js-foo'));
  20. foo.render({ str: 'baz' });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement