Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys,

I have component 1 contain props1 and props2 as optional props in component parent i return React.cloneElement contain props

like this

React.cloneElement(children, {
props1:{
... children.props.props1,
Val:'test'
},
props2:'test'
})


Problem in this component parent show error

Cause it don't have all time children with this props

Error

Unknown event handler property 'props' it will be ignored.

 

Thanks


What I have tried:

React.cloneElement(children, {
props1:{
... children.props.props1,
Val:'test'
},
props2:'test'
},...children.props)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900