aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/react/server-v17.js
diff options
context:
space:
mode:
authorGravatar Josh Goldberg ✨ <git@joshuakgoldberg.com> 2023-07-03 05:59:43 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-03 20:59:43 +0800
commit2fea174303ca60f4765c6294d99ebc7a19e73403 (patch)
tree671f1f27d6d0827e51aaa20704b7f6154ad5d053 /packages/integrations/react/server-v17.js
parentfc6826ff7620b0c5e419de93ef7c463a12fe3652 (diff)
downloadastro-2fea174303ca60f4765c6294d99ebc7a19e73403.tar.gz
astro-2fea174303ca60f4765c6294d99ebc7a19e73403.tar.zst
astro-2fea174303ca60f4765c6294d99ebc7a19e73403.zip
feat: use typescript-eslint@v6's reworked configs (#7425)
Diffstat (limited to 'packages/integrations/react/server-v17.js')
-rw-r--r--packages/integrations/react/server-v17.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/packages/integrations/react/server-v17.js b/packages/integrations/react/server-v17.js
index 522837a16..5638c6fb7 100644
--- a/packages/integrations/react/server-v17.js
+++ b/packages/integrations/react/server-v17.js
@@ -17,8 +17,7 @@ function check(Component, props, children) {
// Note: there are packages that do some unholy things to create "components".
// Checking the $$typeof property catches most of these patterns.
if (typeof Component === 'object') {
- const $$typeof = Component['$$typeof'];
- return $$typeof && $$typeof.toString().slice('Symbol('.length).startsWith('react');
+ return Component['$$typeof']?.toString().slice('Symbol('.length).startsWith('react');
}
if (typeof Component !== 'function') return false;
@@ -73,7 +72,7 @@ function renderToStaticMarkup(Component, props, { default: children, ...slotted
}
const vnode = React.createElement(Component, newProps);
let html;
- if (metadata && metadata.hydrate) {
+ if (metadata?.hydrate) {
html = ReactDOM.renderToString(vnode);
} else {
html = ReactDOM.renderToStaticMarkup(vnode);