Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fetch data in next js

export const getStaticProps = async () => {
  const res = await fetch("https://jsonplaceholder.typicode.com/users");
  const data = await res.json();

  return {
    props: {
      people: data,
    },
  };
};
 
PREVIOUS NEXT
Tagged: #fetch #data #js
ADD COMMENT
Topic
Name
1+4 =