Material UI @mui/material/Button vs @material-ui/core/Button, when did it change, where are docs for older version

huangapple go评论74阅读模式
英文:

Material UI @mui/material/Button vs @material-ui/core/Button, when did it change, where are docs for older version

问题

我想将Material UI添加到我正在开发的React项目中。快速搜索出现了这篇文章Medium.com文章:入门Material-UI For React

我开始观看视频,其中说要使用:

npm install @material-ui/core

并在代码中使用:

import Button from '@material-ui/core/Button';    // 语法 #1

但我遇到了问题,所以查看了官方MUI文档,其中说:

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

并使用:

import Button from '@mui/material/Button';  // 语法 #2

这两个版本都来自同一个Material UI团队吗?如果是这样,我如何获取旧版文档?还是最好使用最新版本(语法 #2)的Material UI 5.13.x,并只使用https://mui.com网站?

寻找解决方案

  • 转到旧网站https://material-ui.com 只会重定向到新网站https://mui.com/core/。

我发现两种语法都在使用:

英文:

I wanted to add Material UI to a React project I'm working on. A quick searched turned up the article Medium.com article Getting Started With Material-UI For React.
I started watching the video which said to use:

npm install @material-ui/core

And in the code to use:

import Button from '@material-ui/core/Button'    // Syntax #1

But I ran into problems, so looked at the offical MUI docs which say:

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

And using

import Button from '@mui/material/Button';  // Sytnax #2

Are both versions from the same Material UI team? If so, how do I get the older docs? Or would it be better to use the latest version (Syntax #2) of Material UI 5.13.x and just use the https://mui.com website?

Searching for solution

I found both both syntaxs being used:

答案1

得分: 1

以下是已翻译好的内容:
material-ui 推出第5版本后,团队将 material-ui 重命名为 mui,已重命名的包列表如下:

@material-ui/core -> @mui/material
@material-ui/system -> @mui/system
@material-ui/unstyled -> @mui/core
@material-ui/styles -> @mui/styles
@material-ui/icons -> @mui/icons-material
@material-ui/lab -> @mui/lab
@material-ui/types -> @mui/types
@material-ui/styled-engine -> @mui/styled-engine
@material-ui/styled-engine-sc ->@mui/styled-engine-sc
@material-ui/private-theming -> @mui/private-theming
@material-ui/codemod -> @mui/codemod
@material-ui/docs -> @mui/docs
@material-ui/envinfo -> @mui/envinfo

v5 的文档,v4 的文档,v3 的文档。

英文:

After material-ui introduced the 5th version, the team renamed material-ui to mui, list of renamed packages:

@material-ui/core -> @mui/material
@material-ui/system -> @mui/system
@material-ui/unstyled -> @mui/core
@material-ui/styles -> @mui/styles
@material-ui/icons -> @mui/icons-material
@material-ui/lab -> @mui/lab
@material-ui/types -> @mui/types
@material-ui/styled-engine -> @mui/styled-engine
@material-ui/styled-engine-sc ->@mui/styled-engine-sc
@material-ui/private-theming -> @mui/private-theming
@material-ui/codemod -> @mui/codemod
@material-ui/docs -> @mui/docs
@material-ui/envinfo -> @mui/envinfo

Docs for v5, v4, v3

huangapple
  • 本文由 发表于 2023年5月31日 22:54:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76374814.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定