问题
Just starting (again) with material UI and react. There are two packages material-ui and @material-ui, which is the best starting point (latest) as of 2019-07 timeframe?
I think it is npm install @material-ui/core
based on ... https://material-ui.com/getting-started/installation/. The GIT repo is at https://github.com/mui-org/material-ui
Simple question, hopefully simple answer.
Other questions I looked at:
Use Create-React-App with Material UI - This answer says to use
npm install --save material-ui
but because it is 2 years old, I think it may be out of date.Difference between Material-Ui and Material-Ui-Next
How to install Material-UI Docs WITHOUT installing material-ui?
回答1:
@material-ui/core
is the correct one to use.
If you go to https://www.npmjs.com/package/material-ui, you'll see that material-ui
is deprecated. The last stable version in the material-ui
package was 0.20.2
. For the 1.0 release it moved to @material-ui/core
(and the current version is 4.1.3).
The @material-ui
scope is used for the following packages that are all managed within the monorepo you referenced (https://github.com/mui-org/material-ui):
- @material-ui/core
- @material-ui/icons
- @material-ui/styles
- @material-ui/system
- @material-ui/lab
- @material-ui/utils
- @material-ui/types
- @material-ui/docs
- @material-ui/codemod
回答2:
The @ scope indicates package ownership
The main advantage of scopes I've seen so far is that each scope is controlled by npm account of an organization / user, much like GitHub usernames / organization names.
This way, it makes it easy to determine if the package you are looking at belongs to an organization you trust, or if it is a third party tool.
For example, if you see:
@material-ui
then you know that it comes from the material-ui team and can be trusted.
On the other hand, the same could not be said about:
material-ui
For more https://docs.npmjs.com/about-scopes
来源:https://stackoverflow.com/questions/56875498/difference-between-material-ui-vs-material-ui-without-at-sign