Skip to content

[JSX] Make JSX.create properties list not limited to static list but also works for conditions #4119

@MangelMaxime

Description

@MangelMaxime

Originally reported on Feliz repo here

It is common to have condition in the properties list to conditionally apply some classes for example:

let Ele() =
    JSX.create "div" [
        if 1 = 1 then
            "className", "first"
    ]

currently it fails with error FABLE: Expecting a static list or array literal (no generator) for JSX props

This is because in this case a CEs list is generated by the compiler.

We need to look into unwrapping that CEs like we did for the children list and try to manipulate the AST to generate what we want.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions