Skip to content

Commit

Permalink
catch reparenting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Jun 8, 2019
1 parent 633495f commit b3f3f77
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions compat/src/index.js
Expand Up @@ -78,14 +78,13 @@ class ContextProvider {
function Portal(props) {
let wrap = h(ContextProvider, { context: this.context }, props.vnode);
let container = props.container;
if (!this.mounted) {

if (props.container !== this.container) {
hydrate('', container);
this.container = container;
}
render(wrap, container);
this.componentDidMount = () => {
this.mounted = true;
};

render(wrap, container);
this.componentWillUnmount = () => {
render(null, container);
};
Expand Down

0 comments on commit b3f3f77

Please sign in to comment.