Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
boy51 opened this issue Oct 1, 2020 · 0 comments
Open

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

boy51 opened this issue Oct 1, 2020 · 0 comments

Comments

@boy51
Copy link

boy51 commented Oct 1, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant