Build a list of progress bars that fill one after another — each bar only starts once the previous one has finished. Where Progress Bars animated them all at once, this version sequences them, so you need a bit of state that tracks where in the line you are, plus a timer that advances to the next bar when the current one completes.
// A self-contained component. No props.
function App(): JSX.Element;
Several bars that fill strictly in order: bar 2 begins only when bar 1 reaches 100%.
t = 0.0s bar0 filling, bar1 empty, bar2 empty, bar3 empty
t = 1.2s bar0 FULL, bar1 filling, bar2 empty, bar3 empty
t = 2.4s bar0 FULL, bar1 FULL, bar2 filling, bar3 empty
t = 4.8s all four FULL
Only one bar animates at a time. An `active` index says which; bars before it
are full, the one at it is filling, bars after it are empty.
active index (the bar currently filling). Bars before it are 100%; bars after it are 0%.active to start the next bar. The timer's delay must match the CSS transition duration.The full solution is part of Premium
Walkthrough, edge cases, complexity notes, and the runnable editor unlock with a Premium subscription.
Submissions are part of Premium
Unlock community code, comments, reactions, and framework-specific approaches.
Build a list of progress bars that fill one after another — each bar only starts once the previous one has finished. Where Progress Bars animated them all at once, this version sequences them, so you need a bit of state that tracks where in the line you are, plus a timer that advances to the next bar when the current one completes.
// A self-contained component. No props.
function App(): JSX.Element;
Several bars that fill strictly in order: bar 2 begins only when bar 1 reaches 100%.
t = 0.0s bar0 filling, bar1 empty, bar2 empty, bar3 empty
t = 1.2s bar0 FULL, bar1 filling, bar2 empty, bar3 empty
t = 2.4s bar0 FULL, bar1 FULL, bar2 filling, bar3 empty
t = 4.8s all four FULL
Only one bar animates at a time. An `active` index says which; bars before it
are full, the one at it is filling, bars after it are empty.
active index (the bar currently filling). Bars before it are 100%; bars after it are 0%.active to start the next bar. The timer's delay must match the CSS transition duration.The full solution is part of Premium
Walkthrough, edge cases, complexity notes, and the runnable editor unlock with a Premium subscription.
Submissions are part of Premium
Unlock community code, comments, reactions, and framework-specific approaches.
Unlock the solution & editor
Runnable editor + tests
Solve in the browser with instant Jest feedback.
Detailed solutions
Walkthroughs, edge cases, and complexity notes.
Multi-framework variants
React, Vue, Vanilla, Angular — same question, different stacks.