我有一个模态功能组件
const Modal = ({component, newCompProps, otherStuff}) => {
const modalBody = () => {
return(
<div>{React.createElement(component, newCompProps}</div>
)
}
return(
<div>{modalBody}</div>
)
}
export default Modal
我一直得到这个错误
Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it..
在功能组件中也有一些其他的东西,但我只在上面添加了重要的东西......我还可以如何返回新创建的元素?我也在使用钩子。