패스트컴퍼스 강의를 듣고 정리한 내용입니다.
public폴더 - /접근 가능 ex) src= '/varcel.svg'
: 서버작동( 터미널에 찍힘 ) 서버 부하를 일으킴
export async function getServerSideProps(){
console.log('server');
return {
props: {time : new Date().toISOString()}
}
}
: 클라이언트 작동( 개발자도구 콘솔에 찍힘)
const [time,setTime] = useState();
useEffect(()=>{
setTime(new Date().toISOString())
},[])
: 정적인 사이트 생성한다
getStaticProps : 일반 페이지
getStaticPaths : [id].tsx 페이지 일땐 위 getStaticProps 랑 같이 사용. (같이 안쓰면 경고뜸)
ex) 글이 유지되는 블로그 등에 사용
export async function getStaticProps(){
console.log('server');
return {
props: {time : new Date().toISOString()}
}
}
export async function getStaticProps(){
console.log('server');
return {
props: {time : new Date().toISOString()},
revalidate : 1,
}
}