Reputation:
i even checked the css it is same.
providing code below
class Accordion extends React.Component {
constructor(props) {
super(props);
Upvotes: 2
Views: 68
Reputation: 584
I've created a working solution here: JSFiddle
It seems that React.cloneElement prepends a modifier onto the props that are assigned. So instead of having a prop "_onSelect", it is being prepended by "$Accordion"
A working function call on those props looks like this:
this.props.$Accordion_onSelect(this.props.id);
To remove the $Accordion addition, don't start the prop key with an underscore. If it's just 'onSelect' then it will be passed as 'onSelect'. Here's the JSFIddle
Upvotes: 1