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

Returning plain string from component renders collapsed text nodes on server #10598

Closed
laverdet opened this issue Sep 2, 2017 · 3 comments · Fixed by #11109
Closed

Returning plain string from component renders collapsed text nodes on server #10598

laverdet opened this issue Sep 2, 2017 · 3 comments · Fixed by #11109

Comments

@laverdet
Copy link
Contributor

laverdet commented Sep 2, 2017

Observed this on react@16.0.0-beta.5

import React from 'react';
import { renderToString } from 'react-dom/server';

const B = () => 'b';

console.log(renderToString(<div>{'a'}<B />{'c'}</div>));

This renders as <div data-reactroot="">a<!-- -->bc</div>. If you try to hydrate this you'll get the error: Text content did not match. Server: "bc" Client: "b".

@gaearon
Copy link
Collaborator

gaearon commented Oct 3, 2017

I suppose the bug here is that we do not separate b from c here but we should.

@gaearon
Copy link
Collaborator

gaearon commented Nov 3, 2017

React 16.1.0-beta has been released. Please update react, react-dom, and react-test-renderer (if you use it) to this version and let us know if it solved the issue! We’d appreciate if you could test before Monday when we plan to get 16.1.0 out.

@laverdet
Copy link
Contributor Author

laverdet commented Nov 6, 2017

Everything looks good on my end, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants