I have the following streamlit button:
def _render_settings_button(self, column):
with column.container():
st.button(
":material/settings: Settings",
key="settings_button",
use_container_width=True,
on_click=lambda: st.switch_page(st.session_state["pages"]["settings"])
)
The problem is that when I click the button, I get this error:
Calling st.rerun() within a callback is a no-op.
How can I switch to another page using a st.button
instead of a st.page_link
(I want to use st.button
because of the styling features).
Use st.session_state to keep track of the current page. Update this state when the button is clicked, and use it to show the right page.