Skip to content

Commit

Permalink
💡: modify some outdated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
junerver committed Nov 25, 2024
1 parent e6bbbe0 commit 8d0eec3
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package xyz.junerver.compose.hooks

import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember

/*
Description:
Expand All @@ -14,7 +19,7 @@ import androidx.compose.runtime.*
* Description: 在compose中使用state需要写一点模板代码,虽然谈不上有多麻烦,但是还是能简化一下的;
* 返回值是[MutableState],可以解构后使用。如果是可空对象需要显示声明:
* ```
* val (state,setState) = useState<Boolean?>(null)
* val (state,setState) = _useState<Boolean?>(null)
* val otherState by useState("")
* ```
* 这样做还有一个好处就是减少闭包层级,我们可以轻松的构造一些简单的受控组件:
Expand Down

0 comments on commit 8d0eec3

Please sign in to comment.