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

150
Views
map function not working in ReactJs using nexttjs

I am new in ReactJS and i am using "Nextjs" framework,Right now i am using "async" function for fetching data but unable to fetch using "map" function, in console.log ...showing me following message " items: undefined }",Here is my code,Where i am wrong ?

import React, { Component } from 'react';
const blog =({items}) =>{
  console.log({items});
  return(
  <div>
   </div>
);
};


//calling api for get data
export const getstaticprops=async()=>{
console.log('Om Success');
    const res=await fetch('https://jsonplaceholder.typicode.com/posts');
    const posts = await res.json()
    return {
      props: { items: posts },
    }
  
}
export default blog
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

test this code !

const blog =({posts}) =>{
  console.log(posts); \\ fix console log
  return(
  <div>

  </div>
);
};
export async function getServerSideProps(){
console.log('Om Success');
    const res = await fetch('https://jsonplaceholder.typicode.com/posts');
    const posts = await res.json()
    return {
      props: { posts }, \\ remove items
    }
  
}
about 4 years ago · Juan Pablo Isaza Report
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!