Using splitProps to preserve reactivity in LoginModal

This commit is contained in:
Imbus 2024-02-27 04:02:42 +01:00
parent fafce18907
commit da4f5cbb13

View file

@ -1,4 +1,4 @@
import { JSXElement, Show, onCleanup, useContext } from "solid-js"; import { JSXElement, Show, onCleanup, splitProps, useContext } from "solid-js";
import { LoginForm } from "../Components/Login"; import { LoginForm } from "../Components/Login";
import { RegisterForm } from "../Components/Register"; import { RegisterForm } from "../Components/Register";
@ -61,10 +61,11 @@ export function LoginModal(): JSXElement {
} }
// Local wrapper component for the login and register forms // Local wrapper component for the login and register forms
function FormContainer({ children }: { children: JSXElement }): JSXElement { function FormContainer(props: { children: JSXElement }): JSXElement {
const [local] = splitProps(props, ["children"]);
return ( return (
<div class="tab-content rounded-box border-base-300 bg-base-100 p-2 md:p-10"> <div class="tab-content rounded-box border-base-300 bg-base-100 p-2 md:p-10">
<span class="label-text">{children}</span> <span class="label-text">{local.children}</span>
</div> </div>
); );
} }