I wanted to build a “Cookie clicker” sort of app to learn to use the Streamlit button widget. Basically I want to add 1 to a variable everytime I press the button and the value should change accordingly. However, it does not work in my case.
This is because you are referencing a global variable.
Updating your code as below should work!!