Skip to content
Advertisement

How to display result of map in two different columns

I have a task, but i couldnt get the solution for it in reactjs. I would like to show the result in two columns like: So every next element should be added in the second column, but the first column should be limited to 2 rows.

JavaScript

When i loop through the array the columns are getting divided into equal order, but as you see in the diagram i need to split them in 2:3 ratio. I am giving the sandbox link here on what i have tried so far.

JavaScript
JavaScript

SANDBOX

Advertisement

Answer

You need to add the css on it and also you could slice your array as you like.

this is the piece of the code

JavaScript

Try this codesandbox based on yours for the full code with the css https://codesandbox.io/s/elegant-grass-nmeux

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