theme-standard
Version:
Incompatibility of global CSS Selectors and Components results in various ways we style our Components. It devides our community into 3 categories:
18 lines (14 loc) • 367 B
JavaScript
import React, {PropTypes} from 'react'
/**
* Wrapps the passed component with a Theme component, which will always pass
* the theme as a prop.
*/
export default function useTheme(Component, theme) {
function Theme(props) {
return <Component {...props} theme={theme} />
}
Theme.propTypes = {
theme: PropTypes.object.isRequired
}
return Theme
}