react-reverse-portal
react-reverse-portal copied to clipboard
Child components are re-rendered when switching their OutPortal
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?
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)