The latter was deprecated for the former in the most release.
👍 1
Dominaezzz
02/27/2021, 8:14 PM
Similarly to how we previously removed
state { 0 }
composable and now promote usage like
remember { mutableStateOf(0) }
we are going to remove
savedInstanceState { 0 }
composable. You should use
rememberSaveable { mutableStateOf(0) }
instead and it will save and restore automatically if the type used inside the MutableState can be stored in the Bundle. If previously you were passing a custom saver object now you need to use a new overload of rememberSaveable which has
stateSaver
parameter. The usage will look like this:
val holder = rememberSaveable(stateSaver = HolderSaver) { mutableStateOf(Holder(0)) }