Implementing Session State
摘要
In order to develop more advanced Streamlit applications, it is vital to establish session-specific data that can be used to deliver an enhanced user experience. Specifically, the application will need to preserve the user’s data and inputs using what is referred to as session states. These states can be set and accessed on demand whenever necessary, and they will persist when the user triggers a rerun of the Streamlit application or navigates between pages. In addition, we will establish a method to store state across multiple sessions using cookies, which can save data in the user’s browser for access when they restart the associated Streamlit application. Finally, we will learn how to record and visualize rich insights into how users interact with our application, providing analytics for both the developer and product owner alike.