Create dash wrapper for dragula (drag&drop elements between containers): how to update a child prop

hello,

I have started a wrapper for the dragula drag&drop library (its react version on GitHub - bevacqua/react-dragula: Drag and drop so simple it hurts).

In an event handler bound to the DashDragula component, I would like to change the className of a component (the one being dropped) which is a child of the DashDragula component (even a sub-child). How can I get a reference to the child to do after a child.props.setProps({className: “something”}) ?

an example of the use:

dash_dragula.DashDragula(
            id="dragula_root",
            children=[
                html.Div(
                    children=[html.Div(e, id=e) for e in ["one", "two"]],
                    id="left",
                ),
                html.Div(
                    children=[html.Div(e, id=e) for e in ["three", "four"]],
                    id="center",
                ),
                html.Div(
                    children=[html.Div(e, id=e) for e in ["five", "six"]],
                    id="right",
                ),
            ],
        ),

When one of the sub-sub div (eg the one with id=“three”) is drag & dropped in another children div of dragula_root, I want the className of the sub-sub div to be updated.

1 Like