effect value returns T instead of string
This commit is contained in:
parent
16c3a01d2b
commit
dab0b9f59b
@ -1,7 +1,5 @@
|
|||||||
package naive
|
package naive
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
type Effect[T any] struct {
|
type Effect[T any] struct {
|
||||||
value T
|
value T
|
||||||
listeners []func(newValue T)
|
listeners []func(newValue T)
|
||||||
@ -21,8 +19,8 @@ func UseEffect[T any](value T) *Effect[T] {
|
|||||||
return eff
|
return eff
|
||||||
}
|
}
|
||||||
|
|
||||||
func (eff *Effect[T]) Value() string {
|
func (eff *Effect[T]) Value() T {
|
||||||
return fmt.Sprintf("%v", eff.value)
|
return eff.value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (eff *Effect[T]) SetValue(newValue T) {
|
func (eff *Effect[T]) SetValue(newValue T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user