score:1

Accepted answer

i think this should work:

{
  person &&
    person.map((data, index) => (
      <div
        classname={`${
          (index > 1 && (index % 8 == 1 || index % 8 == 0))
            ? "correct"
            : ""
        }`}
      >
        <div>{data.name}</div>
      </div>
    ));
}

or to make this look a bit pretty! just make a function to check this condition for you!

const iscorrectcondition = i => (i > 1 && (i % 8 == 1 || i % 8 == 0));

{
  person &&
    person.map((data, index) => (
      <div
        classname={`${
          iscorrectcondition(index)
            ? "correct"
            : ""
        }`}
      >
        <div>{data.name}</div>
      </div>
    ));
}

Related Query

More Query from same tag