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

attach react component to already rendered DOM (which is not rendered by react on server) #7712

Closed
pcompassion opened this issue Sep 13, 2016 · 4 comments

Comments

@pcompassion
Copy link

pcompassion commented Sep 13, 2016

I'd like to keep traditional server side rendering (not react rendering with node) and attach client side code.
I believe the following statement might help to achieve that. I wonder if any work is being done.
Or any help or guide on how to mix server rendered content (via server side template such as jinja2 ) with react at the moment would be greatly appreciated.

https://facebook.github.io/react/docs/top-level-api.html states that

ReactDOM.render() does not modify the container node (only modifies the children of the container). In the future, it may be possible to insert a component to an existing DOM node without overwriting the existing children.

@gaearon
Copy link
Collaborator

gaearon commented Sep 13, 2016

There is currently no support for React component reusing non-React-generated markup. Your next best bet would be to use server rendering for static non-React parts, and mount React components on the client side inside those DOM nodes.

@zpao zpao closed this as completed Sep 13, 2016
@chrischrischris
Copy link

https://github.com/auniverseaway/react-dom-components may do what you are looking for.

@gaearon
Copy link
Collaborator

gaearon commented Jan 25, 2018

Technically React 16 can attach to non-React-generated markup although this is pretty fragile.

@tadeo
Copy link

tadeo commented Sep 19, 2018

Technically React 16 can attach to non-React-generated markup although this is pretty fragile.

@gaearon are you referring to Portals?

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

5 participants