Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
Create a new row every three columns

I am trying to create a virtual shop and I want to make every row of products have four items on a large screen, three in medium, and two in smell.

My problem is that I can’t come up with a way to make it that every four items I iterate the item list a new row will be created. (I am getting the data from an API I created with Flask, the getting the data part works.)

Here is my code:

import React, { useState, useEffect } from "react";
import Container from 'react-bootstrap/Container';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';


function ShopItems () {
    const [items, setItems] = useState([]);

    useEffect(() => {
        fetch('/api/items').then(res => res.json()).then(data => {
            setItems(data.items);
        });
    }, []);

    return(
        <Container fluid>
            <Row xs={6} md={4} lg={3}>
            {
                items.map((item) => (
                    <Col key={item.id}>{item.name}</Col>))
            }
            </Row>
        </Container>
    )
}

export default ShopItems;
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are using props incorrectly.

<Container fluid>
  <Row>
    <Col xs={6} md={4} lg={3}></Col>
  </Row>
</Container>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda