0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Next.js, typescript, chakra-ui のプロジェクトの作成の仕方

Last updated at Posted at 2022-08-03

まずはnextjs+typescriptのプロジェクトを作成

npx create-next-app@latest --ts

アプリ名を何にするか聞かれるので任意の名前を入力

chakra-uiのインストール

npm i @chakra-ui/react @emotion/react@^11 @emotion/styled@^11 framer-motion@^6

pages/_app.tsx を編集

import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { ChakraProvider } from '@chakra-ui/react'    // 追加

function MyApp({ Component, pageProps }: AppProps) {
    return (
        <ChakraProvider>  // 追加
            <Component {...pageProps} />
        </ChakraProvider>  // 追加
    )
}

export default MyApp

ChakraProviderをimportして、 <Component {...pageProps} /> を囲う。

一応これでNext.js+typescriptで、chakra-uiが適用されているはず。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?