Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Childless component throws error with Preact 10.x #56

@samueljseay

Description

@samueljseay

I realise Preact 10.x is in alpha but thought I would raise this, hope it helps (I love picostyle thanks for making it).

Here's a simple reproduction: https://codesandbox.io/s/32pwokmxp5

I found that in case of a childless component the children passed to the HOF is {}, but h wants an array. A change of the code in https://github.com/morishitter/picostyle/blob/master/src/index.js#L57 to:

children = children.length ? children : []

solves the issue for me.

I'm not entirely sure if this could be considered a Preact bug, but their VNode implementation is private so maybe we should assume its a needed enhancement to picostyle.

I realise my solution will not necessarily work for the other frameworks. Is it a good time to consider adapters for the diff frameworks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions