I'm pulling products from api. I will list the products by loop. but I am using "card-group" in my design. There is a "card-group" for every 4 products. that is, if I return the direct products with a loop, "card-group" falls on each 1 product. This is causing a defect in my design. how do i overcome this?
My design will be like below. A "card-group" needs to be created for every 4 products:
<div className="card-group mt-5">
<div className="card">
......
</div>
<div className="card ">
......
</div>
<div className="card ">
......
</div>
<div className="card ">
......
</div>
</div>
I am pulling the data as in the photo:
By design it should look like this:
import * as React from 'react';
import {connect} from 'react-redux'
const Urunler = (props) => {
console.log(props);
return (
<div className="row">
<div className="col-md-12">
<div className="card-group mt-5">
<div className="card">
......
</div>
<div className="card ">
......
</div>
<div className="card ">
......
</div>
<div className="card ">
......
</div>
</div>
<div className="card-group mt-5">
<div className="card">
......
</div>
<div className="card ">
......
</div>
<div className="card ">
......
</div>
<div className="card ">
......
</div>
</div>
</div>
</div>
)
}
const mapStateToProps = (state) =>{
return {
products:state.urunler
}
}
export default connect(mapStateToProps)(Urunler)