Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-fela providers only accept single element children #855

Closed
jaydenseric opened this issue Feb 3, 2021 · 2 comments
Closed

react-fela providers only accept single element children #855

jaydenseric opened this issue Feb 3, 2021 · 2 comments

Comments

@jaydenseric
Copy link

Type: Bug

Packages Version
react-fela 11.5.2

Description

The react-fela provider components, RendererProvider and ThemeProvider, should be able to accept any kind of React node as children. Instead, they only accept a single React element child:

Steps to reproduce

import { createRenderer } from 'fela'
import { RendererProvider, ThemeProvider } from 'react-fela'
import MyApp from './MyApp'
import theme from './theme'

const renderer = createRenderer()

export default () => (
  <RendererProvider renderer={renderer}>
    <div>Hello world</div>
    <ThemeProvider theme={theme}>
      <div>Hello world</div>
      <MyApp />
    </ThemeProvider>
  </RendererProvider>
)

Expected Behavior

Renders without an error.

Actual Behavior

Fails to render with a React render error:

Error: React.Children.only expected to receive a single React element child.
@robinweser
Copy link
Owner

I don't see why this is a bug. Fair enough, nowadays we don't really need the Children.only anymore, but there's nothing breaking or misbehaving. Just pass a single child for now and it works fine e.g. wrap it with <></>.
Still a good point to remove those with the next version.

@ghost
Copy link

ghost commented Feb 11, 2021

Handled in #856.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants