Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
67 views
in Technique[技术] by (71.8m points)

javascript - Material-UI React using in static HTML

I am new to react especially when using with HTML but i want to use in my web page which is HTML.I know that there is way to implant because i saw react documentation here. First i should add

  <script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
  <script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>

But i dont know how to continue with adding this library. It is MATERIAL-UI React. If anyone knows how to implant it in static HTML wab page, i will be very glad. Sorry for bad English.

question from:https://stackoverflow.com/questions/65902839/material-ui-react-using-in-static-html

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can add the cdn via a script tag like this:

<script src="https://unpkg.com/@material-ui/core@latest/umd/material-ui.development.js" crossorigin="anonymous"></script>

You can also take a look at the example here.

But quoting the docs, this is heavily discouraged:

?? Using this approach in production is discouraged though - the client has to download the entire library, regardless of which components are actually used, affecting performance and bandwidth utilization.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...