This is a very simple scenario where you need to hide/show some div but you can’t use <template if:true> tag. Let’s say you’re using loop.

Here we’re discussing 2 approaches if you’re looking for answer to how you can use dynamic hide/show in LWC without template if:true approach

Toggle Class (Simple Approach)

Toggle (classList Approach)

Source https://salesforce.stackexchange.com/questions/260614/lwc-how-to-toggle-css-class-on-button-click

Leave a Comment