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

Child components are re-rendered when switching their OutPortal #18

Open
bduffany opened this issue Dec 13, 2020 · 1 comment
Open

Child components are re-rendered when switching their OutPortal #18

bduffany opened this issue Dec 13, 2020 · 1 comment

Comments

@bduffany
Copy link

bduffany commented Dec 13, 2020

See this example: https://codesandbox.io/s/nifty-fire-ihho4?file=/src/index.tsx

When switching the OutPortal, the child component of the InPortal (i.e. the "expensive" component) appears to get re-rendered, although the component that is rendering the InPortal doesn't get re-rendered.

Is this a bug or is there a problem with that example?

@bduffany
Copy link
Author

bduffany commented Dec 13, 2020

It does appear that if I use React.PureComponent, the component does not re-render: https://codesandbox.io/s/affectionate-bouman-y201q?file=/src/index.tsx.

However it's rendered twice initially. Is this also a bug? (EDIT: I sent #19 to fix this)

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