nextjs Data List
- NEXT.JS 기본개념
- NEXT.JS 설치
- NEXT.JS 실행방법
- NEXT.JS 파일 및 구조
- NEXT.JS 데이터 가져오기
- NEXT.JS API 쿼리데이터 생성
- NEXT.JS Components
- NEXT.JS page.js 파라미터 처리
- NEXT.JS app router 방식 client ip 주소 가져오는 방법
- NEXT.JS monaco-editor 사용방법
- NEXT.JS react-quill 사용방법
- NEXT.JS app router 방식 rss feed.xml 간단하게 설정 방법
- NEXT.JS app router 방식 sitemap.xml 간단하게 설정 방법
NEXT.JS 데이터 가져오기
2023-11-14 00:00:00
/ 목차 /
- NEXT.JS 데이터 가져오기
NEXT.JS 데이터 가져오기
- fetch함수를 사용해서 API 데이터를 가져오는 부분입니다 이부분이 중요한 이유는 DB데이터를 가져와서 화면에 보여주는 역활을 하기 때문입니다.code async function getData() { const res = await fetch('https://api.datadeveloper.kr/...') // The return value is *not* serialized // You can return Date, Map, Set, etc. if (!res.ok) { // This will activate the closest `error.js` Error Boundary throw new Error('Failed to fetch data') } return res.json() } export default async function Page() { const data = await getData() return <main></main> }
Comment