Last active
August 10, 2018 17:56
-
-
Save ninjaPixel/41f78d1fd01ed4b81759e21229ccb3cf to your computer and use it in GitHub Desktop.
Our 'Test' component. It pulls in some external libs, bloating our Meteor app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import { withStyles, Typography } from '@material-ui/core'; | |
import moment from 'moment'; | |
import _ from 'lodash'; | |
const Test = (props) => { | |
const { classes, name } = props; | |
const lodash = _.get({}, 'x', true); | |
console.log('lodash: ', lodash); | |
const x = _.cloneDeep({ hello: 'world!' }); | |
const time = new moment(); | |
return ( | |
<div className={classes.root}> | |
<Typography variant="display1" >Hello, {name}!</Typography> | |
<Typography>This component depends upon the material-ui, moment, and lodash libraries.</Typography> | |
<Typography>These libraries are loaded dynamically, which means that they are kept out of the initial client bundle️, which reduces the bundle size significantly.</Typography> | |
<Typography>Current date (calculated by moment.js): {time.toString()}</Typography> | |
</div> | |
); | |
}; | |
const style = theme => ({ | |
root: { | |
padding: theme.spacing.unit * 10, | |
height:150, | |
backgroundColor: 'yellow', | |
}, | |
}); | |
export default withStyles(style)(Test); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment