SolidJSS
SolidJS16mo ago
rez2o_

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?

// ...
const [signal, setSignal] = createSignal(false);
let refDiv1, refDiv2;
createEffect(async ()=> {
    if(signal()) {
        refDiv1.style.display='block';
        await new Promise(resolve => setTimeout(resolve, 1000));
        refDiv2.style.display='block';
        await new Promise(resolve => setTimeout(resolve, 1000));
       // ... 
    }
})
Was this page helpful?