我收到以下错误
Warning: memo: The first argument must be a component. Instead received: object
Uncaught Error: Objects are not valid as a React child (found: object with keys {$$typeof, type, compare}). If you meant to render a collection of children, use an array instead.
当我更改此组件时它们会发生
const Tab = () => onLastTab
? <AccountTab data={data.account} />
: <InfoTab data={data.info} />
要成为这个组件,唯一的区别就是使用了 React.memo
const Tab = () => onLastTab
? React.memo(<TabOne data={data.one} />)
: React.memo(<TabTwo data={data.two} />)
包装在 React.memo 中的那些组件肯定只是看起来像的功能组件
const TabOne = ({data}) => (
<div>
<div className='d-flex '>
...
</div>
</div>
)
为什么会发生这种情况?我能做些什么来阻止它?