effect value returns T instead of string

This commit is contained in:
Frank Mayer 2025-01-20 20:17:20 +01:00
parent 16c3a01d2b
commit dab0b9f59b
Signed by: tsukinoko-kun
GPG Key ID: 427B3E61E69C2E51

View File

@ -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) {