Best method to keep the state of a widget

Hi there
I finally have how to keep the state of a widget like for example selectbox if I change section with a sidebar for example

what surprises me is that the only valid method is to go through a callback and especially why the key of the widget here ‘value’ disappears when I change section
The disappearance of the ‘value’ key is an official feature of streamlit ?
wouldn’t it be wiser to keep this key as long as there is no clear cache and thus avoid switching from one key to another via a callback?

Attached is the sample code

import streamlit as st

options = ['a','b']
if 'index' not in st.session_state:
    st.session_state['index'] = 0

def func_():
    st.session_state['index'] = options.index(st.session_state['value'])
section  ='',['S1','S2'])

if section =='S1':   
    index  = st.session_state['index']
    side = st.selectbox("test" ,options = options,index = index, key = 'value', on_change = func_)
if section =='S2':

1 change selectbox to ‘b’
2 pass in section ‘S2’
3 return to section ‘S1’

we find the state of the widget on ‘b’ but the key value has disappeared

thank you in advance

no one have any idea or my question is not clear ?