Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!