[Vuejs]-[Vue warn]: Error in render: "RangeError: Invalid array length" [Vue JS]

0👍

This feels like a reactivity error.

You are trying to onload loop over an array that has nothing in it. Its NULL.

What you want to do is wrap your for-loop in an if statement to make sure its only run when data is actually present:

<div class="card-place" v-if="tableCards">
        <card v-for="(card, index) in tableCards" :card="card"></card>
</div>

Or you can initialize your TableCards with something in it, but utilizing vueJs’s reactivity engine would be preferable.

Once placeTableCards() is run, Vuejs should pick up on the data change, the if-statement will pass true, and your loop should execute.

Leave a comment