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

243
Vistas
map() method dosent show items of the array ES6

hi everyone I tried to make an input to put some items(URL) in my array(references), its work but the part of the map doesn't show anything. why that's happen?

I mean when I put some URL in the input I see that the array (references) had length in the dev tool => console but I cant show the array items with map() method and idk whats the problem ...

import { useState } from "react";

export default function ArticlesReferences() {
  const [references, setReferences] = useState([]);
  const [links, setLinks] = useState("");

  const addReference = (links) => {
    setReferences([...references, {links}]);
  };
  const removeReference = (links) => {
    setReferences(references.filter((reference) => reference.links !== links));
  };
  const handleSubmit = (e) => {
    e.preventDefault();
    addReference(links);
    setLinks("");
  };
  return (
    <>
      <div>
        <ul>
          {references.map((reference) => {
            <li styles={{ fontSize: "2rem" }} key={reference.links}>
              <span> {reference.links}</span>
              <span onClick={() => removeReference(reference.links)}>X</span>
            </li>;
          })}
        </ul>
      </div>
      <form onSubmit={handleSubmit}>
        <input
          type="url"
          placeholder="enter your url"
          value={links}
          onChange={(e) => setLinks(e.target.value)}
        />
        <input type="submit" value="enter" />
      </form>
    </>
  );
}

about 4 years ago · Juan Pablo Isaza
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