Skip to content

Is it possible to modify an existing gomponent? #191

Answered by markuswustenberg
AxelRHD asked this question in Q&A
Discussion options

You must be logged in to vote

You could do something like:

type YourComponent struct {
    children []g.Node
}

func (c *YourComponent) AddChild(child Node) {
    c.children = append(c.children, child)
}

func (c *YourComponent) Render(w io.Writer) error {
    // Render however you want to the writer
    return nil
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@AxelRHD
Comment options

@markuswustenberg
Comment options

Answer selected by AxelRHD
@AxelRHD
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #190 on August 07, 2024 12:37.