【发布时间】:2022-01-16 17:01:12
【问题描述】:
我想制作一个组件,但我希望它也接受元素。例如:
组件:
const Example = () => {
return (
<div>
//Some Elements will come here.
</div>
)
}
另一页:
const App = () => {
return (
<Example>
<div>
<h1>Hello all </h1>
<p>I want that elements acceptable on my custom component </p>
</div>
</Example>
)
}
但我只能发送道具,我不能在我的组件标签内写任何东西。我怎样才能做到?谢谢大家!
【问题讨论】:
-
“我不能在我的组件的标签内写任何东西”是什么意思?
标签: javascript html reactjs