Skip to content
Discussion options

You must be logged in to vote

If anyone is stuck with this problem, finally I resolved it

I have used getStaticProps as I wanted to get the data from Build time, so I followed getStaticProps else you guys can use getServerSideProps

export async function getStaticProps() {
  // Call an external API endpoint to get posts.
  const res = await  fetch('https://jsonplaceholder.typicode.com/todos');
  let users= await res.json();
  
  return {
    props: {
      users,
    },
  };
}

Then I use

function mypage({users}){
return(
<ChildComponents data={users} />
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mvgadagi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant