aleph.js icon indicating copy to clipboard operation
aleph.js copied to clipboard

`<Link>`'s `to` prop should accept `undefined`/`null`/`""` as values

Open aslilac opened this issue 3 years ago • 1 comments
trafficstars

In particular, you get a runtime error when passing "" because it fails a truth-y check. Being able to pass undefined and null, and treating them as "" would be an additional bonus.

aslilac avatar Jun 08 '22 15:06 aslilac

Looking into the source, it was clear that the property isn't optional.
I'm not sure if this would be a good change.

You can validate the to prop before creating the element.
I don't know, maybe the owners of the project could give some light on this topic.

shinspiegel avatar Nov 17 '22 07:11 shinspiegel