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

react-dom/server: renderToString fails with array type children #10212

Closed
tushar-singh opened this issue Jul 18, 2017 · 11 comments
Closed

react-dom/server: renderToString fails with array type children #10212

tushar-singh opened this issue Jul 18, 2017 · 11 comments

Comments

@tushar-singh
Copy link

React 16 alpha allows returning array in render function but server renderer expects children to always be react elements

TypeError: Cannot read property 'toLowerCase' of undefined
    at ReactDOMServerRenderer.renderDOM

source

function renderDOM(element, context) {
    var tag = element.type.toLowerCase(); // element is array

Fiddle: https://jsfiddle.net/84v837e9/160/

react@16.0.0-alpha.13

@gaearon
Copy link
Collaborator

gaearon commented Jul 18, 2017

Yep, this is a known limitation and will be fixed before 16. Would you be interested in implementing this?

@tushar-singh
Copy link
Author

I'm not quite sure how yet. I'll go through the code and give it a shot

@evilbs
Copy link
Contributor

evilbs commented Jul 19, 2017

hi,@gaearon,I am interested in implementing this.

@gaearon
Copy link
Collaborator

gaearon commented Jul 19, 2017

If either of you could try and send a PR that would be great! The code is in ReactPartialRenderer.

@evilbs
Copy link
Contributor

evilbs commented Jul 19, 2017

@gaearon @tushar-singh , I has been completed, I will send PR.

you can view the online demo:
address: http://www.ygyblog.com/rs/

@gaearon
Copy link
Collaborator

gaearon commented Jul 19, 2017

Cool, happy to review a PR.

@evilbs
Copy link
Contributor

evilbs commented Jul 24, 2017

@gaearon, please review my PR. I have completed.

@gaearon
Copy link
Collaborator

gaearon commented Jul 31, 2017

Fixed by #10221.

@gaearon gaearon closed this as completed Jul 31, 2017
@iduuck
Copy link

iduuck commented Nov 22, 2017

I don't know why I am the only one, but this is still happening for me. Getting this with Version v16.1.1.

@gaearon
Copy link
Collaborator

gaearon commented Nov 22, 2017

File a new issue with a reproducing case please.

@gaearon
Copy link
Collaborator

gaearon commented Nov 22, 2017

It's hard to keep track of problems in closed issues so I'll lock this one.

@facebook facebook locked and limited conversation to collaborators Nov 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants