嗨,我正在尝试在我的父组件中添加一个组件作为道具,然后从父方法向子组件添加道具,例如:
function Parent(props) {
const ParentChild = props.child;
return (
<ParentChild someprop=1 />
)
}
function Child(props) {
return <span>{props.someprop}</span>
}
当我创建父母时:
<Parent child={Child} />
这似乎不起作用我该怎么做?我正在使用 React 和 TypeScript