A
A
Alexander2022-02-18 10:29:30
React
Alexander, 2022-02-18 10:29:30

What is the correct way to add n number of arrays in 1 iteration and div wrapper every 5 iterations?

There is an array, a larger number comes, let's say 100 pieces.
I need to cram the number of these arrays into one slider by n, for example 5 pieces. and wrap it in a div. In general, what would be 1 slide. I use the react-slick library

<Slider {...settingsSlider}>
{data.map((elem, i)=> (
                  <div className="slider_coin">
                    <div className="slider_coin_icon">
                      <img src={elem.icon} alt="" />
                    </div>
                    <div className="slider_coin_info">
                      <h4>{elem.name}</h4>
                      <p>{elem.price_usdt} $ {elem.percent_change > 0 ?
                        <span className='distributionSchedule_green'>
                          +{elem.percent_change?.toFixed(1)}%
                        </span>
                        :
                        <span className='distributionSchedule_red'>
                          {elem.percent_change?.toFixed(1)}%
                        </span>
                      }</p>
                    </div>

                  </div>
                ))
                }
  </Slider>


With this approach, 1 element displays, which is logical. But you need more in 1 slide, something does not reach me, as it is right

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question