React中MUI初始化和方法调用

step1:引用

npm install @mui/material @emotion/react @emotion/styled

step2:D:\vue\untitled2123\src\App.tsx

import React from 'react';
import logo from './logo.svg';
import './App.css';
import Button from '@mui/material/Button';

function App() {

    const GetAmount = (strAmount: number, grams: number) => {
        return strAmount + grams;
    };

    const Tile = () => {
        console.log('you click button')
    }

    return (
        <div className="App">
            <header className="App-header">
                <img src={logo} className="App-logo" alt="logo"/>
                <Button onClick={Tile} variant="contained">{GetAmount(7, 9)}</Button>
            </header>
        </div>
    );
}

export default App;


end