Skip to content
Advertisement

Select a grid element from a .map

I have a grid and I need to select the fourth element and move from the first column to second column in the row below. I know how to do it in plain html, but not how to select the grid element inside a map.

Here the code:

JavaScript

I just need to select the fourth element and put this className: className='col-start-2'

Here an image to understand the problem: grid

Advertisement

Answer

You can use the index of the map to check if its the 4th iteration.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement