Package Exports
- @emotion/provider
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@emotion/provider) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@emotion/provider
A React component to provide a theme to child components
Install
yarn add @emotion/providerUsage
/** @jsx jsx */
import { jsx } from '@emotion/jsx'
import styled from '@emotion/styled'
import * as React from 'react'
import ThemeProvider from '@emotion/provider'
let SomeParagraph = styled.p`
color: ${props => props.theme.primaryColor};
`
class SomeComponent extends React.Component {
constructor(props) {
super(props)
this.state = {
theme: {
primaryColor: 'hotpink'
}
}
}
render() {
return (
<ThemeProvider theme={this.state.theme}>
<h1 css={theme => ({ color: theme.primaryColor })}>some heading</h1>
<SomeParagraph>some text</SomeParagraph>
</ThemeProvider>
)
}
}