how to update the DOM styles in a time sequence when a single signal changes?
I want a group of
div
elements to appear one by one.
I tried to do this, it seems that createEffect
only updates once?
7 Replies
it should be fine
signals and async can be tricky, when you access signals after an await it will not add itself to effect's subscriptions, but since you do it before you await anything, it should be fine
https://playground.solidjs.com/anonymous/a324cdcc-6673-4150-8351-a8f8899d88a9 you can see in the log that it logs
hallo
each secondSolid Playground
Quickly discover what the solid compiler will generate from your JSX template
the approach is a bit footgunny tho, you would need to think about a way that you can abort the async code though: what to do when the effect is called again while the async function is still running?
a more css-y approach: https://playground.solidjs.com/anonymous/dfeb2b92-2fbf-4380-b30a-67f0eae8a47e
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
if you need to mount the html-elements (you can sadly not animate
display
with pure css), i would advice the following: https://playground.solidjs.com/anonymous/cdfd7235-4e8f-481a-80d8-b6f64baf6de9
instead of having the async code in one big block (and then needing to deal with the possibility of the effect being called again while the async function is still running), you let solid's createResource
take care of itSolid Playground
Quickly discover what the solid compiler will generate from your JSX template
thx a lot! Your solution is very clear
I really stuck by the asyn in createEffect function, I shouldn't do this.
u are super welcome!