react pass prop conditionally code example
Example 1: conditional props react
// single prop
propName={ condition ? something : somethingElse }
propName={ condition && something }
// multiple props
{ ...( condition ? { ...setOfProps } : { ...setOfOtherProps })}
{ ...( condition && { ...setOfProps })}
Example 2: give a prop only if pass condition
<Child {...(this.props.editable ? {editable: {this.props.editableOpts}} : {})} >