TripleSmile
TripleSmile
SSolidJS
Created by TripleSmile on 7/23/2024 in #support
How to use a resource in a structure field as a reactive signal?
this would probably make my life a lot easier but I had made architectural mistakes so to say and just trying to finish things up so the code is weird and reason is missing 😅
10 replies
SSolidJS
Created by TripleSmile on 7/23/2024 in #support
How to use a resource in a structure field as a reactive signal?
thank you guys! For some reason didn't think of passing accessor without their call, thanks!!!!
10 replies
SSolidJS
Created by TripleSmile on 7/23/2024 in #support
How to use a resource in a structure field as a reactive signal?
isnt resource a signal itself? I suppose using resource to set value to another signal and using that in my structure would just do the same thing and would't update. Or am I missing something here?
10 replies
SSolidJS
Created by TripleSmile on 2/3/2024 in #support
How to use ref both inside and outside(parent) component?
It kinda works but the code looks a bit weird to me. Maybe I'm doing this wrong? 😄 I've read some information about refs but I don't understand exactly how to think about what's happening under the hood so to say. I don't fully understand what is asigned where and when...
const [myDialog, setMyDialog] = createSignal<HTMLDialogElement | undefined>();
return (
<div>
<div class="grid grid-cols-2 border gap-2 mx-auto min-w-[420px] max-w-[840px] px-4">
{totalPrice()}
<button onClick={() => myDialog()?.showModal()}>Terms!</button>
</div>

<Dialog
text="Shis is terms of service text text text, do you agree? 12354123135
5645343 231E"
ref={(el: any) => {
setMyDialog(el);
}}
myDialog={myDialog}
/>
</div>
const [myDialog, setMyDialog] = createSignal<HTMLDialogElement | undefined>();
return (
<div>
<div class="grid grid-cols-2 border gap-2 mx-auto min-w-[420px] max-w-[840px] px-4">
{totalPrice()}
<button onClick={() => myDialog()?.showModal()}>Terms!</button>
</div>

<Dialog
text="Shis is terms of service text text text, do you agree? 12354123135
5645343 231E"
ref={(el: any) => {
setMyDialog(el);
}}
myDialog={myDialog}
/>
</div>
function Dialog(props) {
return (
<dialog
onClick={() => {
props.myDialog()?.close();
}}
ref={props.ref}
class="fixed inset-0 items-center justify-cente p-4"
>
<div
onClick={(e) => e.stopPropagation()}
class="border min-w-[420px] max-w-xl mx-auto bg-white p-1"
>
{props.text}
<button
onClick={() => {
props.myDialog()?.close();
}}
>
Press me
</button>
</div>
</dialog>
);
}
export default Dialog;
function Dialog(props) {
return (
<dialog
onClick={() => {
props.myDialog()?.close();
}}
ref={props.ref}
class="fixed inset-0 items-center justify-cente p-4"
>
<div
onClick={(e) => e.stopPropagation()}
class="border min-w-[420px] max-w-xl mx-auto bg-white p-1"
>
{props.text}
<button
onClick={() => {
props.myDialog()?.close();
}}
>
Press me
</button>
</div>
</dialog>
);
}
export default Dialog;
14 replies
SSolidJS
Created by TripleSmile on 2/3/2024 in #support
How to use ref both inside and outside(parent) component?
Interesting, thank you, I will try that
14 replies
SSolidJS
Created by TripleSmile on 2/3/2024 in #support
How to use ref both inside and outside(parent) component?
I think this tutorial is relevant maybe, but it doesn't do anything with ref inside Canvas.jsx: https://www.solidjs.com/tutorial/bindings_forward_refs?solved
14 replies
SSolidJS
Created by TripleSmile on 8/28/2023 in #support
Proper implementation of a timer/stopwatch
I rewrote it to use Date.now() for it to not go out of sync if an application potentially laggs or something like that
10 replies
SSolidJS
Created by TripleSmile on 8/28/2023 in #support
Proper implementation of a timer/stopwatch
yes, exactly like this! Thank you very much! 🙂
10 replies