reactpy icon indicating copy to clipboard operation
reactpy copied to clipboard

The key attribute is not being properly propagated and applied to importedElements

Open Archmonger opened this issue 10 months ago • 0 comments

Discussed in https://github.com/reactive-python/reactpy/discussions/1270

Originally posted by shawncrawley February 10, 2025 I could not get GridLayout to work as a dynamically loaded component. After digging into the issue, I found that it was because the children of a GridLayout must have the key attribute, but it is not being found on the children when constructing the GridLayout object on the client side. I am clearly passing it in on the Python side, as seen in my example below, so it is getting dropped/lost somewhere.

return GridLayout(
    Props(
        className="layout",
        layout=layout,
        cols=12,
        rowHeight=30,
        width=1200,
    ),
    lib.html.div(Props(key="a"), "a"),
    lib.html.div(Props(key="b"), "b"),
    lib.html.div(Props(key="c"), "c")
)

Archmonger avatar Feb 11 '25 19:02 Archmonger