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

314
Views
TypeError: post.map () no es una función

Mostrará continuamente este error de que TypeError: post.map no es una función. por favor dame alguna respuesta apropiada guyz.

 import React from "react"; import { useState } from "react"; function LoopThrough() { const [post, setpost] = useState(""); function getDataFromApi() { // using axios method axios .get("https://jsonplaceholder.typicode.com/posts") .then((get) => { console.log(get.data); setpost(get.data); }) .catch((error) => { console.log(error); }); } const getdatafromjson = post.map((myobj) => { return ( <div> <h2>{myobj.title}</h2> </div> ); }); return ( <> <h2>Return Html using http methods</h2> <button onClick={getDataFromApi}>Get Data</button> {getdatafromjson} </> ); } export default LoopThrough;

Nota: En este ejemplo, quiero obtener datos de una Api externa usando el método Axios (idioma: React JS) y mostrarlos en la pantalla usando ganchos de reacción y el método map() pero no funciona.

Error: TypeError: post.map() no es una función.

about 4 years ago · Santiago Trujillo
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!