假设我有这些 React 组件:
const Compo1 = ({theName}) => {
  return (
    <Nested foo={() => console.log('Dr. ' + theName)}/>
  );
};
const Compo2 = ({theName}) => {
  function theFoo() {
    console.log('Dr. ' + theName);
  }
  return (
    <Nested foo={theFoo}/>
  );
};
和嵌套组件,包裹在memo:
const Nested = React.memo(({foo}) => {
  return (
    <Button onClick={foo}>Click me</Button>
  );
});
在传递函数foo中总是重建中Compo1还Compo2,是否正确?
如果是这样,既然foo每次都收到一个新的函数,是不是就意味着memo没用了,所以Nested总是要重新渲染?