Is there any way to get the current index of iteration on array of objects.

<template for:each={prWrap.listOccu} for:item="occu" for:index="occIndex">
  • 6
    What do you think occIndex is? – sfdcfox Sep 18 '20 at 13:50
  • i am trying to display the record with title "occ record 1", "occ record 2" but if you will just use occIndex then title would be displayed like "occ record 0", occ record 1". Expression function is not allowed in LWC {occIndex} + 1. Also i have array of objects then how I can map the property with index. – Moni Jaiswal Sep 18 '20 at 17:46
  • I got the solution thanku. – Moni Jaiswal Sep 21 '20 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.