Skip to content

Props don't get passed if the child is a memo #37

Open
@boy51

Description

@boy51

Hi,

const Memo = React.memo(props => {
  console.log(props);
  if (!props.position) throw new Error("No position");
  return <div>Yolo</div>;
});

function App() {
  return (
         <ReactCursorPosition>
            <Memo />
          </ReactCursorPosition>
  );
}

The Memo component in the example will throw an error. If you remove the Memo, props get passed as expected.

Please forgive me if this is not a bug and rather a limitation of React.memo. But the way I see it, props should be passed regardless, no?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions