I am trying to write an application where every 3 bookmarks, Svelte closes the Row and begins a new one, allowing for the rows to continue. I use sveltestrap components, and these are the "Row", "Col" and "Card*" tags seen.
<Row>
{#each bookmarks as bookmark, i}
<Col>
<Card class="mb-3">
<CardHeader>{bookmark.title}</CardHeader>
<CardBody>
<CardSubtitle>{#each Array(parseInt(bookmark.rating)) as _, i}
<img fill="#ffffff" src="/res/star-fill.svg" alt="Star">
{/each}{#each Array(5 - parseInt(bookmark.rating)) as _, i}
<img src="/res/star.svg" alt="Star">
{/each}
</CardSubtitle>
<CardText>{bookmark.description}</CardText>
</CardBody>
<CardFooter>{bookmark.rating}</CardFooter>
</Card>
</Col>
{#if (i % 3 === 0)}
</Row>
<Row>
{/if}
{/each}
</Row>
This gives me an error about closing an element that doesn't exist, but I'm trying to close the row before it. Is there any way for Svelte to see the previous element in its array?