How to add condition for 1st Iteration in views-view-fields.html.twig file I am trying to implement a carousel , inside my views-view-fields--block_1.html.twig , I want to add  active class inside the div for the first Iteration . I have added the code in twig file but every time it is adding active class for all the iteration. 

code snippet:

{% if fields.counter.content == 1 %}
{% set tag = "active" %}
{% else %}
{% set tag = "" %}
{% endif %}


In my view title,body,image and result counter fields are there . From result counter i am getting the value and comparing inside the above twig file. Can anyone give suggestion, how to achieve this.

Thanks,
If your code snippet is within a for loop, you could use either loop.first or loop.index in your if statement to target the first iteration. 
 Refer to https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable

Thus your twig template would probably resemble:

{% for item in items %}
  {% if loop.first 1 %}
    {% set tag = "active" %}
  {% else %}
    {% set tag = "" %}
  {% endif %}

... render row/field with class in template ...
{% endfor %}