Style Hooks

<StylesConsumer>

A React context consumer that provides access to the theme object defined in your ThemeProvider in addition to two functions for imperatively replacing and merging a new theme in your provider.

Render props

  • stylesContext <object>

  • theme <object>

    The current theme as defined in this context hook's nearest provider

  • replaceTheme <function>

    Replaces the current theme with the theme you provide as the first argument here

  • setTheme <function>

    Deep merges the current theme with the theme you provide as the first argument here

CodeSandbox example

Below is a complete <StylesConsumer> example

Continue to useStylesContext()
NPM icon
MIT License ©2019
Jared Lunde