ARSON
ARSON
Explore posts from servers
SSolidJS
Created by ARSON on 5/6/2024 in #support
porting over some ssr react code, getting different behavior
good to know, thanks!
8 replies
SSolidJS
Created by ARSON on 5/6/2024 in #support
porting over some ssr react code, getting different behavior
oh, looks like that did it
8 replies
SSolidJS
Created by ARSON on 5/6/2024 in #support
porting over some ssr react code, getting different behavior
wondering what's causing the differences and how i can solve it
8 replies
SSolidJS
Created by ARSON on 5/6/2024 in #support
porting over some ssr react code, getting different behavior
No description
8 replies
SSolidJS
Created by ARSON on 5/6/2024 in #support
porting over some ssr react code, getting different behavior
then i've got this code with solidstart
// index.tsx
import { clientOnly } from "@solidjs/start";

const Foo = clientOnly(() => import("../components/Foo"));

export default function Home() {
return (
<>
{/* <form> */}
<Foo />
{/* </form> */}
{/* <form> */}
<Foo />
{/* </form> */}
</>
);
}
// index.tsx
import { clientOnly } from "@solidjs/start";

const Foo = clientOnly(() => import("../components/Foo"));

export default function Home() {
return (
<>
{/* <form> */}
<Foo />
{/* </form> */}
{/* <form> */}
<Foo />
{/* </form> */}
</>
);
}
// foo.tsx
import { Show, createEffect, createSignal } from "solid-js";

export default function Foo() {
const [foo, setFoo] = createSignal<HTMLDivElement | null>(null);
const isFormControl = () => (foo() ? Boolean(foo()!.closest("form")) : true);

console.log(isFormControl());
createEffect(() => {
console.log(isFormControl());
});

return (
<>
<div ref={node => setFoo(node)}>hello world</div>
<Show when={isFormControl}>
<div>hello world 2</div>
</Show>
</>
);
}
// foo.tsx
import { Show, createEffect, createSignal } from "solid-js";

export default function Foo() {
const [foo, setFoo] = createSignal<HTMLDivElement | null>(null);
const isFormControl = () => (foo() ? Boolean(foo()!.closest("form")) : true);

console.log(isFormControl());
createEffect(() => {
console.log(isFormControl());
});

return (
<>
<div ref={node => setFoo(node)}>hello world</div>
<Show when={isFormControl}>
<div>hello world 2</div>
</Show>
</>
);
}
8 replies