npm init next-app react-next-movie
yarn add @chakra-ui/core
yarn add @chakra-ui/react
yarn add @chakra-ui/theme
yarn add @chakra-ui/react
- 手动安装
@chakra-ui/react
的依赖包yarn add @emotion/react @emotion/styled
- 手动安装
@emotion/react
的依赖yarn add framer-motion
- 没有克隆主题: 使用依赖包的形式
import theme from "@chakra-ui/theme"
- 在
pages
文件夹下建立_app.js
加入如下代码
import { ChakraProvider, CSSReset } from "@chakra-ui/react";
import theme from "@chakra-ui/theme";
function MyApp({ Component, pageProps }) {
return (
<ChakraProvider theme={theme}>
<CSSReset />
<Component {...pageProps} />
</ChakraProvider>
);
}
export default MyApp;
yarn add react-icons
yarn add @babel/core
@emotion/babel-preset-css-prop
- 在根目录下创建 .babelrc 文件并添加如下代码
{
"presets": ["next/babel","@emotion/babel-preset-css-prop"]
}