Skip to content Skip to sidebar Skip to footer

Debugged The Code I Think It Will Be This Function Onselect

I had working code in react class but when I changed to React.Component the whole UI is breaking. debugged the code I think problem will be this function onSelect. since if I give

Solution 1:

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

Post a Comment for "Debugged The Code I Think It Will Be This Function Onselect"