Skip to content

E0125: ui.State used with the wrong type ​

A ui.State[T] is a value the browser keeps current. It goes to a prop that takes a ui.State of the same T, and a chain's Set takes a T. A key can't read one. (A write's own types — open = !open on a bool, n++ on a number — are E0150.)

Wrong ​

html
<!-- menu.vuka.html -->
<script lang="go">
type Menu struct {
	open ui.State[bool]
}
</script>

<Label text={!open} />   <!-- Label takes a bool -->
html
<!-- menu.vuka.html -->
<script lang="go">
type Menu struct {
	open ui.State[bool]
}
</script>

<Label text={!open.Get()} />   <!-- or: Label's Text a ui.State[bool] -->

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.