Open tbruyelle opened 6 years ago
That panic may go away in vecty soonTM as there are a few reasons re-using HTML should be valid, though with a cursory search I can't find the exact discussion we had on that.
In the mean time, you can either use a component as content
, or just avoid Link
and use a regular element in your code, then hook event.Click
to call router.Go
to navigate.
I also have an inline router that I started work on that supports link interception, so that regular anchors can be used, and the router will intercept clicks and navigate by either pushState or hash routes, depending on the router config. The interception code should be extractable, but again, I'm afraid I'm really short on time right now.
use a regular element in your code
That's what I did.
I also have an inline router that I started work on that supports link interception, so that regular anchors can be used, and the router will intercept clicks and navigate by either pushState or hash routes, depending on the router config.
This is neat. If it can help, as soon as #2 is merged I can submit an other PR on history/pushState support (see https://github.com/tbruyelle/vectyx/commit/4bb01923598871b289db3d9b2bf23a20d266280c)
But maybe that's something you already handle in your inline router.
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
andLinkWithParam
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 :
But it's sad to not be able to use a component here...
WDYT?