withTheme
FunctionwithTheme<C>(Component: C, multiTheme: boolean): ThemedComponent<C>A higher-order component that provides the current theme as a prop to the wrapped child and listens for changes. If the theme is updated, the child component will be re-rendered accordingly.
import { withTheme } from 'jimu-theme'
const MyComponent = ({ theme }) => (
<div style={{ backgroundColor: theme.sys.color.surface.paper }}>
Hello World
</div>
)
export default withTheme(MyComponent)Type Parameters
| Parameter | Type |
|---|---|
C | ComponentType<ComponentProps<C>> |
Parameters
| Parameter | Type | Default |
|---|---|---|
Component | C | |
multi | boolean | false |
Returns
ThemedComponent<C>