nextjs components
v5.2.0
คำเตือน
โครงการนี้ไม่ได้รับการดูแลอย่างแข็งขัน
คอลเลกชันของส่วนประกอบปฏิกิริยาที่ถอดความจาก https://vercel.com/design 1

บล็อกโพสต์ตั้งแต่ 01/09/2022
# with npm
npm i nextjs-components # with yarn
yarn add nextjs-components โครงการนี้จะต้องถูกส่งต่อเพื่อทำงานกับแอปพลิเคชัน next.js ของคุณ ขอแนะนำให้ใช้ Next.js 13.1.0 โมดูล tranpilation ในตัว (จนถึง next.js 13.1.0 , next-transpile-modules
// next.config.js
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode : true ,
pageExtensions : [ "tsx" , "ts" ] ,
swcMinify : true ,
transpilePackages : [ "nextjs-components" ] ,
} ;
module . exports = nextConfig ; ใช้ไดเรกทอรี app 13 ของถัดไป
"use client" ;
// ./app/layout.tsx
import { ThemeContextProvider } from "nextjs-components/src/contexts/ThemeContext" ;
import "nextjs-components/src/styles/globals.css" ;
export default function RootLayout ( { children } ) {
return (
< html lang = "en" >
< body >
< ThemeContextProvider > { children } </ ThemeContextProvider >
</ body >
</ html >
) ;
} การใช้แบบ ดั้งเดิม _app.tsx แบบกำหนดเอง
// ./pages/_app.tsx
import {
ThemeContextProvider ,
ToastArea ,
ToastsProvider ,
} from "nextjs-components" ;
import "nextjs-components/src/styles/globals.css" ;
function App ( { Component , pageProps } ) {
return (
< ThemeContextProvider >
< ToastsProvider >
< Component { ... pageProps } />
< ToastArea />
</ ToastsProvider >
</ ThemeContextProvider >
) ;
}
export default App ;ตรวจสอบเว็บไซต์เอกสารสำหรับตัวอย่างเพิ่มเติม!
คำเตือน
ลดการสนับสนุน create-react-app
ในเวอร์ชันเก่า ๆ การใช้งานกับ create-react-app ได้รับการสนับสนุน อย่างไรก็ตามจาก >=v1.0.0 โฟลเดอร์ที่สร้างไว้ล่วงหน้า /dist ถูกทิ้ง
สิ่งนี้ไม่เกี่ยวข้องกับ vercel ↩