S
SolidJS•2mo ago
snorbi

Is this a correct implementation? :)

I'm new to both JSX and Solid. Is this a correct implementation or can it be simplified?
const NavLink = (props) => {
const [_, restProps] = splitProps(props, ["href", "children"]);
return <a href={UrlPrefix + props.href} {...restProps}>{props.children}</a>;
}
const NavLink = (props) => {
const [_, restProps] = splitProps(props, ["href", "children"]);
return <a href={UrlPrefix + props.href} {...restProps}>{props.children}</a>;
}
The goal is to render a <a> with a customized href prop, rendering the children, while passing all other props unmodified. Thanks.
2 Replies
Madaxen86
Madaxen86•2mo ago
Looks solid. (Pun intended) 😜
snorbi
snorbiOP•2mo ago
Thanks 😄
Want results from more Discord servers?
Add your server