[Vuejs]-Pass new iterated data to props Vue.js

0πŸ‘

Scope of variable: result is limited to the loop, result won’t be accessible outside the loop, instead will throw reference error, so, moved new-modal inside the loop, also this will enable the component to be rendered for each iteration

<div
  v-for="result  in users"
  :key="result.id"
>
  <div>
   {{ `${result.user.first_name} ${result.user.last_name}` }}
  </div>

  <!-- Here -->
  <new-modal v-bind:result="result"/> 
</div>

Leave a comment