我是 Preact 的新手,无法让它工作。我期望此代码呈现“TEST SUCCESSFUL”,但它只呈现“TEST”
<div id="app"></div>
<script type="importmap">
{
"imports": {
"preact": "https://esm.sh/[email protected]",
"htm/preact": "https://esm.sh/[email protected]/preact?external=preact"
}
}
</script>
<script type="module">
import { render } from 'preact'
import { html } from 'htm/preact'
function Successful() {
return html`
<div>SUCCESSFUL</div>
`
}
function App() {
return html`
<div>TEST</div>
<Successful />
`
}
render(html`<${App} />`, document.getElementById('app'));
</script>
似乎也没有任何错误。我做错了什么?