ReactDOM.render
expects as first argument an instantiated component, you are just passing jsx
.
(ReactDOM.render
期望实例化组件作为第一个参数,您只是传递jsx
。)
function App() {
return (
<main>
<h1>Below is my component</h1>
<Html_component />
</main>
)
}
function Html_component() {
return (
<main>
<div style="border-radius: 50%; background-color: black; width: 10px; height: 10px;"></div>
</main>
)
}
ReactDom.render(<App />, document.getElementById('root'));
Remeber, a functional component
is a function which returns jsx
(记住,功能component
是返回jsx
的函数)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…