Skip to content

Commit d980274

Browse files
authored
Merge pull request #24 from preactjs/hydrate-option
Support zero-mutation hydration via an attribute
2 parents 8a17904 + df302c9 commit d980274

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)