✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here.

How to bind click callbacks to a dynamically generated list of buttons

I have a quite simple use case. I’m displaying a list of images and want to have a like/dislike button next to each image, something like this

# inside a callback which determines what is in `paths`
return [
  html.Span([
        html.Button("Like"),
        html.Button("Dislike"),
        html.Img(src=path)
    ]) for path in paths]

I can’t find any information on how to define callbacks in any other way than with the decorator.

All I want really is to figure out which button was pressed.

See Dynamic Controls and Dynamic Output Components