purescript-pux
purescript-pux copied to clipboard
Single element children props is not an array with preact
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:
While in react:
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
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.
I've added a failing travis test in this fork's pull request