✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

Callback function of button is called automatically

I am using the similar button callback code as mentioned in the dash guide. But the problem I am facing is that the callback function is called automatically at the start , even when the button is not pressed. I need that function should only be called when the button is pressed.

Check if n_clicks==None and then raise dash.exceptions.PreventUpdate()

Callbacks will always be fired at the start to keep everything consistent

1 Like