설치
Data Fetching 데이터를 가져오기
export async function getServerSideProps()
console.log("hi")
return {
props: { time: new Date().toISOString() },
};
}
-> hi는 서버에서 그려서 나오기 때문에 콘솔에 안나옴
-> 새로고침을 해도 계속 데이터가 변한다.
react 쓰듯이 쓴다.
``jsx
export async function getStaticProps()
console.log("hi")
return {
props: { time: new Date().toISOString() },
};
}
※ getStacticPath()
export async function - getStaticProps ()
console.log("hi")
return {
props: { time: new Date().toISOString() },
revalidate:1 // 1초단위
};
}