render(){
let tags = this.props.tags;
if(!Array.isArray(this.props.tags)){
tags = [tags];
}
let tagsDisplayName="name";
if(tags.length>0){
const category = tags[0].category;
if(category==="product"||category==="samplecode"){
tagsDisplayName = "name" + "description" // NG (no value displayed)
tagsDisplayName="name"//OK (name value is displayed)
}
}
return(
<div style={this.props.style}>
<span>{this.state.error}</span>
<TagsInput
Omitted.
tagDisplayProp={tagsDisplayName}
Omitted.
It's hard to understand what the question is for, but
If you want to combine strings, I think you should use a template string.
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/template_strings
${tagsDisplayName} description
© 2024 OneMinuteCode. All rights reserved.