From c897728eb8b51f24c2e579a4c1b2cb0323cbf720 Mon Sep 17 00:00:00 2001
From: MadCcc <1075746765@qq.com>
Date: Mon, 9 May 2022 16:23:07 +0800
Subject: [PATCH] docs: update demo template (#35440)
---
site/theme/template/Content/Demo/index.jsx | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/site/theme/template/Content/Demo/index.jsx b/site/theme/template/Content/Demo/index.jsx
index 24417a6108..0d2e307655 100644
--- a/site/theme/template/Content/Demo/index.jsx
+++ b/site/theme/template/Content/Demo/index.jsx
@@ -223,8 +223,10 @@ class Demo extends React.Component {
'const { $1 } = ReactRouterDOM;',
)
.replace(/([A-Za-z]*)\s+as\s+([A-Za-z]*)/, '$1:$2')
- .replace(/export default/, 'const Demo =')}\n\n${
- react18 ? 'createRoot(mountNode).render()' : 'ReactDOM.render(, mountNode)'
+ .replace(/export default/, 'const ComponentDemo =')}\n\n${
+ react18
+ ? 'createRoot(mountNode).render()'
+ : 'ReactDOM.render(, mountNode)'
};\n`,
css: prefillStyle,
editors: '001',
@@ -253,8 +255,10 @@ class Demo extends React.Component {
react18
? `import React from 'react';\nimport { createRoot } from 'react-dom/client';\n`
: ''
- }${sourceCode.replace(/export default/, 'const Demo =')}\n\n${
- react18 ? 'createRoot(mountNode).render()' : 'ReactDOM.render(, mountNode)'
+ }${sourceCode.replace(/export default/, 'const ComponentDemo =')}\n\n${
+ react18
+ ? 'createRoot(mountNode).render()'
+ : 'ReactDOM.render(, mountNode)'
};\n`,
css: prefillStyle,
json: JSON.stringify(