I am trying to get a bootstrap accordion running, where my panels are React classes. Somehow this doesn't work:
<ReactBootstrap.Accordion>
<WontWorkPanel pkey={1} />
<WontWorkPanel pkey={2} />
</ReactBootstrap.Accordion>
The WontWorkPanel
is React class that renders the single panel with the key this.props.pkey
.
Could someone explain me what I'm doing wrong, or how to do it better?
Thanks!
The Accordion clones its children with new props, and those props control the showing/hiding of the
Panel
component. To allow that to still work with a customPanel
wrapper, you need to transfer props from the wrapper to thePanel
child:Fiddle: http://jsfiddle.net/ssorallen/3azxcquh/6/