In my style component I have a class that changes the backgound color of a button as follows:
<style>
.button:global(:nth-child(2)) {
background-color: red;
}
</style>
My issue is that I don't want the nth-child hard-coded, I would like it to be a variable, as seen below.
<script>
let x = 5
</script>
<style>
.button :global(:nth-child(x)) {
background-color: red;
}
</style>
Is this even possible?