Skip to content

Link and LinkWithParam error #3

@tbruyelle

Description

@tbruyelle
Uncaught Error: vecty: next child render must not equal previous child render 
(did the child Render illegally return a stored render variable?)

If I understood well Vecty doesn't let you return stored variable on Render, you have to return a new element on each call.

Because Link and LinkWithParam accepts a content for the anchor, this content is stored inside the struct and so causes the Vecty error.

One fix could be to not use a component but just a wrapper around the anchor :

func Link(path string, content vecty.ComponentOrHTML) vecty.ComponentOrHTML {
  return elem.Anchor(
    vecty.Markup(
      prop.Href(`javascript:;`),
      event.Click(onClick).PreventDefault().StopPropagation(),
    ),
    content,
  )
}
// The fix is not complete...

But it's sad to not be able to use a component here...

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions