react-fela providers only accept single element children
jaydenseric opened this issue · 2 comments
jaydenseric commented
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 commented
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.
Deleted user commented
Handled in #856.