nextjs components
v5.2.0
警告
このプロジェクトは積極的に維持されていません。
https://vercel.com/designから転写されたReactコンポーネントのコレクション。 1

01/09/2022からのブログ投稿
# with npm
npm i nextjs-components # with yarn
yarn add nextjs-componentsこのプロジェクトは、next.jsアプリケーションで動作するために透過する必要があります。 next.js 13.1.0の組み込みモジュールトランピレーションを使用することをお勧めします。 (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 ; Next 13のapp Directoryを使用します
"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フォルダーが削除されました。
これはヴェルセル↩と提携していません