FelaTheme

Note: If you're working with React > 16.3, we highly recommend using the useFela hook instead.
It's more easy and safe to use and also has the best rendering performance.

FelaTheme is an alternative component to the withTheme-HoC leveraging the render-props pattern. It is used to access the theme object that is specified and passed down via React's context(new tab) APIs by a ThemeProvider.

Props

PropertyTypeDescription
childrenFunctionA render function that receives the theme object as its first parameter.

Imports

import { FelaTheme } from 'react-fela'
import { FelaTheme } from 'preact-fela'
import { FelaTheme } from 'inferno-fela'

Example

<FelaTheme>
{(theme) => <div>Primary color is ${theme.primary}.</div>}
</FelaTheme>