summaryrefslogtreecommitdiff
path: root/packages/integrations/react/server.js
diff options
context:
space:
mode:
authorGravatar HiDeoo <494699+HiDeoo@users.noreply.github.com> 2023-01-25 23:31:57 +0100
committerGravatar GitHub <noreply@github.com> 2023-01-25 16:31:57 -0600
commit9d4bfc76e8de7cf85997100145532a6fa7d2b025 (patch)
tree03cf2a6a99106987f395b2517cf431c1d0eefc1e /packages/integrations/react/server.js
parentdabce6b8c684f851c3535f8acead06cbef6dce2a (diff)
downloadastro-9d4bfc76e8de7cf85997100145532a6fa7d2b025.tar.gz
astro-9d4bfc76e8de7cf85997100145532a6fa7d2b025.tar.zst
astro-9d4bfc76e8de7cf85997100145532a6fa7d2b025.zip
Support passing `children` as props to a React component (#5886)
Diffstat (limited to 'packages/integrations/react/server.js')
-rw-r--r--packages/integrations/react/server.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js
index 1ebd044cf..01a135a9b 100644
--- a/packages/integrations/react/server.js
+++ b/packages/integrations/react/server.js
@@ -69,8 +69,9 @@ async function renderToStaticMarkup(Component, props, { default: children, ...sl
...props,
...slots,
};
- if (children != null) {
- newProps.children = React.createElement(StaticHtml, { value: children });
+ const newChildren = children ?? props.children;
+ if (newChildren != null) {
+ newProps.children = React.createElement(StaticHtml, { value: newChildren });
}
const vnode = React.createElement(Component, newProps);
let html;