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

135
Vistas
How to input array into 1 column table

How to input array into 1 column table ? Audience number 2 have 2 Films B & C. I want to become 1 column. ex [Film B, Film C] in Column Film.

My Table => The Table Image

const AudienceListComponent = () => {
    const [audience, setAudience] = useState([])
    console.log("audience", audience)
    const getAllAudience = () => {
        AudienceService.getAllAudiences().then((response) => {
            console.log('response', response)
            setAudience(response.data)
        })
    }
    useEffect(() => {
        getAllAudience()
    }, [])
    return (
        <div>
            <table className="table table-bordered table-bordered">
                <thead className="table-dark">
                <tr>
                    <th>No</th>
                    <th>Audience Name</th>
                    <th>Film</th>
                </tr>
                </thead>
                <tbody>
                {
                    audience.map((aud, i) => (
                        <tr key={aud.id}>
                            <td>{i + 1}</td>
                            <td>{aud.name}</td>
                            {aud.film.map(films =>
                                <td>{films.title}</td>
                            )}
                        </tr>
                    ))
                }
                </tbody>
            </table>
        </div>
    );
};
export default AudienceListComponent;
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Solved by @Hamza Khan in a comment:

You need to run the map loop inside your td element like this: <td> {aud.film.map(films => films.title )} </td>

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