E0151: Markup outside a .vuka.html file
Markup is written in .vuka.html files, and only there: a .vuka.html file declares one struct in its <script lang="go"> and its markup below renders it. .vuka and .go files are logic — services, models, helpers, main — and hold no markup. A .vuka.html file's script holds none either: its markup follows </script>.
The compiler still lowers markup the way it lowered JSX in a .vuka file; it is the place it is written that is one. A function that returned markup becomes a component: a .vuka.html file whose struct's exported fields are the function's parameters, used as a tag.
Wrong
vuka
// card.vuka
package components
type Card struct {
Title string
}
func (c Card) View() ui.Node {
return <h2>{c.Title}</h2>
}Right
html
<!-- card.vuka.html -->
<script lang="go">
package components
type Card struct {
Title string
}
</script>
<h2>{Title}</h2>