Why do the docs use `by remember { mutableStateOf(...
# compose
a
Why do the docs use 
by remember { mutableStateOf(selection) }
 instead of
rememberUpdatedState
 ? Seems like the latter is the same just more refined?
n
you should put a link to which doc
1
and probably because
rememberUpdatedState
is val only, while remember { mutableState) can be a var/modified
but the issue I see with by remember { mutableStateOf(selection) } is if selection change if won't recreate the state so that's an issue (at least for my newb eyes)
a
They are completely different. The former just captures the initial value of
selection
, while the latter turns
selection
into a
State
, which will be updated when
selection
changes.
☝🏼 1
☝🏻 1
☝️ 1