当前位置: 首页 > 工具软件 > Material UI > 使用案例 >

next.js入门之集成material-ui

陈刚洁
2023-12-01

地址:https://github.com/mui-org/material-ui

 

1.安装

 

// with npm
npm install @material-ui/core

// with yarn
yarn add @material-ui/core

 

2,集成

 

2.1 _app.tsx

 

import React from 'react';
import PropTypes from 'prop-types';
import Head from 'next/head';
import { ThemeProvider } from '@material-ui/core/styles';
import CssBaseline from '@material-ui/core/CssBaseline';
import theme from '../src/theme';
import type { AppProps } from 'next/app'

export default function MyApp(props:AppProps) {
  const { Component, pageProps } = props;

  React.useEffect(() => {
    // Remove the server-side injected CSS.
    const jssStyles = document.querySelector('#jss-server-side');
    if (jssS
 类似资料: