Skip to content

Commit 533c83a

Browse files
authored
Support zero-mutation hydration via an attribute
1 parent c049872 commit 533c83a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { h, cloneElement, render } from 'preact';
1+
import { h, cloneElement, render, hydrate } from 'preact';
22

33
export default function register(Component, tagName, propNames) {
44
function PreactElement() {
@@ -21,7 +21,7 @@ export default function register(Component, tagName, propNames) {
2121

2222
function connectedCallback() {
2323
this._vdom = toVdom(this, this._vdomComponent);
24-
render(this._vdom, this);
24+
(this.hasAttribute('hydrate') ? hydrate : render)(this._vdom, this);
2525
}
2626

2727
function attributeChangedCallback(name, oldValue, newValue) {

0 commit comments

Comments
 (0)