How to prevent the transmission of parameters to the component depending on the conditions?

You need to prevent passing parameters to the component

<Component 
{
 param == 'none' 
 ? 
 param1 = {this.props.param1}
 param2 = {this.props.param2}
 : null
}
/>


I know that it is possible to separately prohibit the transfer

But what to do if there are too many criteria ?

How to do something like that ?

March 19th 20 at 08:31
1 answer
March 19th 20 at 08:33
Solution
const { param1, param2 } = this.props;

const props = param === 'none' ? {} : { param1, param2 };

return (
 <Component {...props} />
);

Find more questions by tags React