What is a difference between an `if` block and `on_click` for a button?

Hi,

In the above mentioned thread, the difference between callbacks and if was explained by @mathcatsand (link to the specific message is Explaining run logic with buttons - #2 by mathcatsand)

As also mentioned earlier, the app reruns upon widget interaction. In the Docs, you can see that st.button (is also a widget) will have a on_click, while other widgets such as st.slider, st.text_input, st.selectbox, etc. will have on_change.

Hope this helps :slight_smile:

Best regards,
Chanin

1 Like