Next.js教學
Next.js 教學
1.建立專案
npm init -y
npm install --save react react-dom next{
"scripts": {
"dev": "next"
}
}npm run devconst Index = () => (
<div>
<p>Hello Next.js</p>
</div>
)
export default Index2.新增client Route
3.新增共用layout component
4.引入<script>或是其他html tag
5.讀取url
6.Router Masking
7.自訂Server
8.使用Fetch獲取Data
9. Style JSX
如果要加上外部css檔案
10. 部署
使用Nginx
11. 部署到 Now
Next UI
額外功能
1. 輸出靜態頁面
Next.js 使用 antd (ant design)
PM2 執行 Next.js
Last updated