This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val isValidHashtag: Boolean by remember { | |
| + Log.i("Saurabh", "Running remember block") | |
| derivedStateOf { | |
| + Log.i("Saurabh", "Calculating derivedStateOf") | |
| !inputHashTag.contains(" ") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - val isValidHashtag: Boolean by remember { | |
| + val isValidHashtag: Boolean by remember(hashtags) { | |
| derivedStateOf { | |
| !inputHashTag.contains(" ") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| private fun PostHashtags( | |
| hashtags: ImmutableList<String>, | |
| onAddHashTag: (String) -> Unit, | |
| modifier: Modifier | |
| ) { | |
| - var inputHashTag by remember(hashtags) { mutableStateOf("") } | |
| + val inputHashTag = remember(hashtags) { mutableStateOf("") } | |
| - val isValidHashtag: Boolean by remember { | |
| + val isValidHashtag: Boolean by remember(inputHashTag) { |
OlderNewer