Answer the question
In order to leave comments, you need to log in
How to disable passing parameters to a component depending on conditions?
It is necessary to prohibit passing parameters to the component
<Component
{
param == 'none'
?
param1 = {this.props.param1}
param2 = {this.props.param2}
: null
}
/>
Answer the question
In order to leave comments, you need to log in
const { param1, param2 } = this.props;
const props = param === 'none' ? {} : { param1, param2 };
return (
<Component {...props} />
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question