useStylesContext()

A React context hook 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.

Returns

  • 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 useStylesContext() hook example