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
import "fmt"
type Effect[T any] struct {
value T
listeners []func(newValue T)
@ -21,8 +19,8 @@ func UseEffect[T any](value T) *Effect[T] {
return eff
}
func (eff *Effect[T]) Value() string {
return fmt.Sprintf("%v", eff.value)
func (eff *Effect[T]) Value() T {
return eff.value
}
func (eff *Effect[T]) SetValue(newValue T) {