SolidJSS
SolidJSโ€ข15mo agoโ€ข
2 replies
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>;
}

The goal is to render a <a> with a customized href prop, rendering the children, while passing all other props unmodified.
Thanks.
Was this page helpful?