useCounter

fun useCounter(initialValue: Int = 0, optionsOf: CounterOptions.() -> Unit): Tuple5<Int, (Int) -> Unit, (Int) -> Unit, (Either<Int, (Int) -> Int>) -> Unit, () -> Unit>


fun useCounter(initialValue: Int = 0, options: CounterOptions): Tuple5<Int, IncFn, DecFn, SetValueFn<SetterEither<Int>>, ResetFn>

Deprecated

Please use the performance-optimized version. Do not pass the Options instance directly. You can simply switch by adding `=` after the `optionsOf` function. If you need to use an older version, you need to explicitly declare the parameters as `options`

Use counter

Return

在使用第三个解构值SetValueFn时,如果你想传入的是数值则使用 left 函数, 如果想传入的是函数 则使用 right 函数,也可以手动导入invoke来优化使用体验。

When using the third destructured value SetValueFn, if you want to pass in a numerical value, use the left function. If you want to pass in a function, use the right function. You can also manually import invoke to optimize the user experience.

set(3.left())
set({value:Int ->
value/3
}.right())

Parameters

initialValue

initial value of count

options