Black Lives Matter. Please consider donating to Black Girls Code today.

Button callbacks firing on every render

Hi - I’ve got a situation that I can’t replicate in a simple demo app - a button callback is firing on other render changes when it is not actually clicked. I’ve tried moving the button completely outside to the top of my layout where it’s definitely not being called - if I click it then n_clicks returns 1 or greater, as it should, then on the other interaction the button is fired again & maintains the same n_clicks count. Doesn’t replicate in a tiny app built with just a button & another callback, so it must be something special I’m doing - just thought I’d check if this rings a bell with anyone & what to look out for?

Figured this out - this was firing due to the target of the button callback re-rendering.