Callbacks, Relation between State and Events - Multiple buttons

Hi, assuming that you can only click on one button once at a time, you can use the “n_clicks_timestamp” attribute like this. :

@app.callback(
    Output('current_page', 'value'),
    [Input('buttonA', 'n_clicks_timestamp'),
     Input('buttonB', 'n_clicks_timestamp')])
def update_output(*args):
    buttons = ['buttonA', 'buttonB']

    args = [0 if i is None else i for i in args]
    if len(args) > 0:
        latest_time = max(args)
        index_of_latest_time = args.index(latest_time)
        return buttons[index_of_latest_time]