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

Render into a different DOM node with same context. #552

Closed
jhernandezb opened this issue Feb 18, 2017 · 3 comments
Closed

Render into a different DOM node with same context. #552

jhernandezb opened this issue Feb 18, 2017 · 3 comments

Comments

@jhernandezb
Copy link

Actually this is possible in react through
ReactDOM.unstable_renderSubtreeIntoContainer(parent, element, containerNode)
so you can do something like this in the render function

    render (){
      ReactDOM.unstable_renderSubtreeIntoContainer(this, <Component />, document.createElement('div'))
    }

The context is inherited from parent which is very useful when using stores like redux, or mobx.

Is there a way to achieve this in preact?

@jhernandezb
Copy link
Author

Sorry I just saw this was recently added.

preactjs/preact-compat#296

@developit
Copy link
Member

FWIW, this is the main selling feature of preact-portal.

@jhernandezb
Copy link
Author

@developit thanks! this is exactly what I wanted.

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

2 participants