summaryrefslogtreecommitdiff
path: root/packages/integrations/preact
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/preact')
-rw-r--r--packages/integrations/preact/client.js21
-rw-r--r--packages/integrations/preact/server.js4
2 files changed, 13 insertions, 12 deletions
diff --git a/packages/integrations/preact/client.js b/packages/integrations/preact/client.js
index e2f4ca803..78d8720f0 100644
--- a/packages/integrations/preact/client.js
+++ b/packages/integrations/preact/client.js
@@ -1,13 +1,14 @@
import { h, render } from 'preact';
import StaticHtml from './static-html.js';
-export default (element) => (Component, props, { default: children, ...slotted }) => {
- if (!element.hasAttribute('ssr')) return;
- for (const [key, value] of Object.entries(slotted)) {
- props[key] = h(StaticHtml, { value, name: key });
- }
- render(
- h(Component, props, children != null ? h(StaticHtml, { value: children }) : children),
- element
- );
-};
+export default (element) =>
+ (Component, props, { default: children, ...slotted }) => {
+ if (!element.hasAttribute('ssr')) return;
+ for (const [key, value] of Object.entries(slotted)) {
+ props[key] = h(StaticHtml, { value, name: key });
+ }
+ render(
+ h(Component, props, children != null ? h(StaticHtml, { value: children }) : children),
+ element
+ );
+ };
diff --git a/packages/integrations/preact/server.js b/packages/integrations/preact/server.js
index 31f980aa3..29ae8a3b0 100644
--- a/packages/integrations/preact/server.js
+++ b/packages/integrations/preact/server.js
@@ -2,7 +2,7 @@ import { h, Component as BaseComponent } from 'preact';
import render from 'preact-render-to-string';
import StaticHtml from './static-html.js';
-const slotName = str => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
+const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
function check(Component, props, children) {
if (typeof Component !== 'function') return false;
@@ -33,7 +33,7 @@ function renderToStaticMarkup(Component, props, { default: children, ...slotted
slots[name] = h(StaticHtml, { value, name });
}
// Note: create newProps to avoid mutating `props` before they are serialized
- const newProps = { ...props, ...slots }
+ const newProps = { ...props, ...slots };
const html = render(
h(Component, newProps, children != null ? h(StaticHtml, { value: children }) : children)
);