SolidJSS
SolidJSโ€ข2mo agoโ€ข
2 replies
ShakeItPT

ParentProps usage and reactivity

When using Parent Props do i still need to use the children helper function or would this be okay

import {ParentProps} from "solid-js";

interface PrimaryButtonProps {
    colorClass: string;
    onClick: () => void;
}

export default function PrimaryButton(props: ParentProps<PrimaryButtonProps>) {
    return (
        <button
            onClick={props.onClick}
            class={"btn-action w-full flex items-center justify-center gap-2 py-3.5 px-4 rounded-xl text-white font-bold text-lg shadow-lg ${colorClass} hover:opacity-90 focus:ring-4 focus:ring-opacity-50 focus:outline-none"}
        >
            {props.children}
        </button>
    );
}
Was this page helpful?