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

308
Views
TypeError: items.map no es una función

por qué mi código muestra

TypeError: items.map no es una función

Estoy tratando de aprender USEEFFECT HOOK en reactjs y recibo este error muchas veces. Estoy muy confundido...

 import './App.css' import React, { useState, useEffect } from 'react' function App() { const [type, setType] = useState(''), [items, setItems] = useState('') useEffect(() => { fetch(`https://jsonplaceholder.typicode.com/${type}`) .then(response => response.json()) .then(json => setItems(json)) console.log(items) }, [type]) return ( <div className="App"> <button onClick={() => setType('posts')}>posts</button> <button onClick={() => setType('users')}>users</button> <button onClick={() => setType('comments')}>comments</button> <div>{type}</div> {items.map(el => { return JSON.stringify(el) })} </div> ); } export default App;
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!