rofrischmann/fela

View on GitHub
website/docs/12.0.2/api/react-fela/FelaTheme.mdx

Summary

Maintainability
Test Coverage
# FelaTheme

> **Note**: If you're working with React > 16.3, we **highly recommend** using the [useFela](api/react-fela/useFela) hook instead.<br />It's more easy and safe to use and also has the best rendering performance.

FelaTheme is an alternative component to the [withTheme](api/react-fela/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](https://reactjs.org/docs/context.html) APIs by a [ThemeProvider](api/react-fela/ThemeProvider).

## Props

| Property | Type       | Description                                                              |
| -------- | ---------- | ------------------------------------------------------------------------ |
| children | _Function_ | A render function that receives the theme object as its first parameter. |

## Imports

```javascript nocopy
import { FelaTheme } from 'react-fela'
import { FelaTheme } from 'preact-fela'
import { FelaTheme } from 'inferno-fela'
```

## Example

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