useTheme
FunctionuseTheme(useDefaultTheme: boolean): IMThemeVariablesA React hook that provides the current theme as its value. If the theme is updated, the child component will be re-rendered accordingly.
import { css } from 'jimu-core'
import { useTheme } from 'jimu-theme'
const MyComponent = () => {
const theme = useTheme()
return (
<div css={css({ backgroundColor: theme.sys.color.surface.paper })}>
Hello World
</div>
)
}Parameters
| Parameter | Type | Default |
|---|---|---|
use | boolean | true |
Returns
IMThemeVariables