# getting-started

Dhya Pacifica

09/20/2023, 2:48 AM
In the declaration/assignment expression: val (selectedOption, onOptionSelected) = remember { mutableStateOf(radioOptions[0]) } I'm not familiar with this syntax. I appears to be initializing and assigning two variables, selectedOption and onOptionSelected. I'm using code similar to this in my app and need to hoist this up the compose chain. selectedOption can be set as a parameter for the child compose as type String. But onOptionSelected is type (String) -> Unit. I'm able to hoist it but if I try to create a @Preview and need to pass in a sample value for it, what do I use?


09/20/2023, 5:38 AM
This syntax is making use of object destructuring. The return type of
is a function which accepts a string and returns nothing, hence
(String) -> Unit
. If you want to pass it a simple value, you can just pass
to it and it should work.