TOBY BB
TOBY BB

Reputation: 45

ES5 with material-ui

In the official website , there is a way to import the Module to the project

   import { Link } from 'react-router-dom'
    import Button from '@material-ui/core/Button';

    <Button component={Link} to="/open-collective">
      Link
    </Button>

However is there anyway to call the object by Browser global(window object)?

Upvotes: 1

Views: 500

Answers (1)

Paul McLoughlin
Paul McLoughlin

Reputation: 2289

You can use a CDN version, include that in your index.html, then you will be able to access it.

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

and the font file.

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">

Here is an example https://github.com/mui-org/material-ui/tree/master/examples/cdn

It should be noted according to their documentation

You can start using Material-UI with minimal Front-end infrastructure, which is great for prototyping. We discourage using this approach in production though - the client has to download the entire library, regardless of which components are actually used, affecting performance and bandwidth utilisation.

Upvotes: 2

Related Questions