rofrischmann/fela

View on GitHub
website/docs/11.7.0/api/react-fela/RendererProvider.mdx

Summary

Maintainability
Test Coverage
# RendererProvider

RendererProvider is used to pass the Fela renderer down to all your child components. It uses React's [context](https://reactjs.org/docs/context.html) APIs to do so. It actually is all you need to fully use Fela within your application.

## Props

| Property       | Type                                                                     | Description                                                    |
| -------------- | ------------------------------------------------------------------------ | -------------------------------------------------------------- |
| renderer       | _[Renderer](api/fela/renderer)_                                          | The Fela renderer which is used to actually render our styles. |
| targetDocument | _[Document](https://developer.mozilla.org/en-US/docs/Web/API/Document)?_ | Document in which's head the styles are injected.              |

## Imports

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

## Example

```javascript
import { createRenderer } from 'fela'

const renderer = createRenderer()

// Wrap your root application with the RendererProvider
// to pass down the renderer to every component using context
const Usage = (
  <RendererProvider renderer={renderer}>
    <App />
  </RendererProvider>
)
```