docs: add the Compositions guide (nesting, props, lifecycle)#83
Merged
Conversation
Add a dedicated Guides page for the composition model — the concept other frameworks call "components." Covers nesting (child = struct field, automatic per-instance state isolation), the single-tree render model, prop passing via View parameters, per-instance state seeding in OnInit (with the by-address binding caveat), and routing child events up through root action methods. Slot it in as Guides nav_order 2 (after Actions & lifecycle), bumping Rendering/Routing/File uploads/Plugins; link the glossary Composition entry to the page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a dedicated Compositions guide — the concept other frameworks call "components," documented under Via's own vocabulary. Closes the long-standing gap where the composition model was scattered across Getting started, the glossary, and Actions & lifecycle with no page of its own.
Contents
View;Mountfolds its state in by reflection, with automatic per-instance isolation via field-prefixed wire keys (A.count,B.count).Viewparameters (compiler-checked, reactive by re-render). Event handlers are props too.OnInitvia.Write(ctx, …), with a verified caveat: never reassign a child by value (binding is by-address beforeOnInit, so a struct-literal reassign zeroesslot/key— the value paints once but client bindings go dead and updates mis-route).Nav / supporting edits
Compositionentry now links to the page.Docs-only;
go build ./...green.