I'm stuck on how to conditionally render (let alone apply styles) while in a for:each according to an expression.
<lightning-layout-item padding="around-small">
<div class="header-column">
<p class="field-title" title="Active">Active</p>
<template for:each={reviews} for:item="review">
<template if:true={review.Id === activeReviewId}> // this doesn't work
<p> key={review.Id}>X</p>
</template>
</template>
</div>
</lightning-layout-item>
All I'm trying to do, is if the review.Id matches the currently active Id, add an "X" next to the item. I can't use a get
expression handler because while the handler knows about this.activeReviewId
, it doesn't receive any params so it can't evaluate if the current index being iterated upon matches. I know how to do this with a parent/child relationship, but I just literally want to put an "X" next to the active review, and creating three files seems insane.
Any suggestions welcome, thank you.