xoldyckk
xoldyckk
Explore posts from servers
SSolidJS
Created by xoldyckk on 8/15/2023 in #support
Help me build a custom link component which adheres to solid's principles
@draw.uy
import { ParentComponent, splitProps } from "solid-js";
import { A } from "solid-start";
import { type AnchorProps } from "@solidjs/router";

export const CustomLink: ParentComponent<
{
sameSite: boolean;
} & AnchorProps
> = (props) => {
const [local, remainingProps] = splitProps(props, ["children", "sameSite"]);

return (
<A
target={local.sameSite ? "_self" : "_blank"}
{...remainingProps}
>
{local.children}
</A>
);
};
import { ParentComponent, splitProps } from "solid-js";
import { A } from "solid-start";
import { type AnchorProps } from "@solidjs/router";

export const CustomLink: ParentComponent<
{
sameSite: boolean;
} & AnchorProps
> = (props) => {
const [local, remainingProps] = splitProps(props, ["children", "sameSite"]);

return (
<A
target={local.sameSite ? "_self" : "_blank"}
{...remainingProps}
>
{local.children}
</A>
);
};
So, if I'm understanding this correctly I should extract out the the reactive values I pass down from the parent component in the object local and spread out the remainingProps into the <A> tag? At least for this piece of code.
3 replies
SSolidJS
Created by xoldyckk on 8/15/2023 in #support
Help me build a custom link component which adheres to solid's principles
thanks i'll take a look
3 replies
SSolidJS
Created by xoldyckk on 12/11/2022 in #support
Can we use solid's For and Index component for data that isn't stored as a signal?
is it good to create two copies of the same data?
4 replies