purescript-pux icon indicating copy to clipboard operation
purescript-pux copied to clipboard

Single element children props is not an array with preact

Open jmatsushita opened this issue 7 years ago • 2 comments

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 avatar Jun 27 '17 14:06 jmatsushita

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 avatar Jun 27 '17 14:06 jmatsushita

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

jmatsushita avatar Jun 27 '17 20:06 jmatsushita