Created
October 15, 2016 22:52
-
-
Save codeocelot/76269f3e660f8210f1fa64d055cd4910 to your computer and use it in GitHub Desktop.
Material UI's MuiThemeProvider Component
This file contains 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 {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