Skip to content

Instantly share code, notes, and snippets.

@codeocelot
Created October 15, 2016 22:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeocelot/76269f3e660f8210f1fa64d055cd4910 to your computer and use it in GitHub Desktop.
Save codeocelot/76269f3e660f8210f1fa64d055cd4910 to your computer and use it in GitHub Desktop.
Material UI's MuiThemeProvider Component
import {Component, PropTypes} from 'react';
import getMuiTheme from './getMuiTheme';
class MuiThemeProvider extends Component {
static propTypes = {
children: PropTypes.element,
muiTheme: PropTypes.object,
};
static childContextTypes = {
muiTheme: PropTypes.object.isRequired,
};
getChildContext() {
return {
muiTheme: this.props.muiTheme || getMuiTheme(),
};
}
render() {
return this.props.children;
}
}
export default MuiThemeProvider;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment