anschelburk / nutrient_guide

Apache License 2.0
0 stars 0 forks source link

Learn more about Streamlit #20

Open ryaustin opened 9 months ago

ryaustin commented 9 months ago

After our session on 27-Feb-24, I realize that I needed to learn a little more about how streamlit works. One thing I learned for example is the behavior we saw with using on_click in the buttons.

Whenever a callback is passed to a widget via the on_change (or on_click) parameter, the callback will always run before the rest of your script. For details on the Callbacks API, please refer to our Session State API Reference Guide.

Also, there is a st.cache_data that allows you to manage persistent state of an object (such as the dictionary for nutrients_i_need.

Read more here: https://docs.streamlit.io/get-started/fundamentals/main-concepts

anschelburk commented 9 months ago

Thank you - read through that page, and also checking out Streamlit's Caching page. Took a screenshot of a potential concern - maybe we can talk next time about what this means, and how much it matters to my code?

image