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

Single element children props is not an array with preact #132

Open
jmatsushita opened this issue Jun 27, 2017 · 2 comments
Open

Single element children props is not an array with preact #132

jmatsushita opened this issue Jun 27, 2017 · 2 comments
Labels

Comments

@jmatsushita
Copy link
Contributor

Hi there,

I've reproduced the problem I alluded to in #131 about differences between preact and react.

Basically it seems that when passing a children array in preact it is passed as a VNode with children whereas in React it is passed as an array of objects.

I'm shortly pushing two forks of the todomvc example that I used to reproduce the problem. They use a simple React component wrapper that replaces the ul element that holds the todo items and logs the children prop to the console.

In preact the console shows:
image

While in react:
image

This causes some problems interoperating with React components that expect an Array here. At first it seemed related to module aliasing but in the end I don't think it is.

Any thoughts if this is a pux problem or an upstream problem?

Jun

jmatsushita added a commit to iilab/pux-todomvc that referenced this issue Jun 27, 2017
jmatsushita added a commit to iilab/pux-todomvc that referenced this issue Jun 27, 2017
@jmatsushita
Copy link
Contributor Author

Oh, it seems that the children is not an array when it is a single element. i.e. when passed a two element children then both branches work the same.

@jmatsushita jmatsushita changed the title Children props is not an array with preact Single element children props is not an array with preact Jun 27, 2017
jmatsushita added a commit to iilab/purescript-pux that referenced this issue Jun 27, 2017
@jmatsushita
Copy link
Contributor Author

I've added a failing travis test in this fork's pull request

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

No branches or pull requests

2 participants