Reactjs 通过三元运算符映射更改特定图标?

Reactjs 通过三元运算符映射更改特定图标?,reactjs,Reactjs,我通过render构建了一个地图,我让一切都按预期运行,但是我在代码中发现了一个小错误,当我点击编辑按钮时,它会通过地图更改所有编辑按钮。如何仅更改该特定地图图标的编辑图标,而不通过渲染地图影响所有其他图标 这是我的密码: 从“React”导入React; 从“../common/标题图标”导入标题图标; 从“../common/Header”导入标题; 从'react router dom'导入{Link}; 从“力矩”中导入力矩; 从“反应确认警报”导入{confirmAlert}; 从“

我通过
render
构建了一个地图,我让一切都按预期运行,但是我在代码中发现了一个小错误,当我点击编辑按钮时,它会通过地图更改所有编辑按钮。如何仅更改该特定地图图标的编辑图标,而不通过渲染
地图
影响所有其他图标

这是我的密码:

从“React”导入React;
从“../common/标题图标”导入标题图标;
从“../common/Header”导入标题;
从'react router dom'导入{Link};
从“力矩”中导入力矩;
从“反应确认警报”导入{confirmAlert};
从“react js Pagination”导入分页;
从“反应CKEditor组件”导入CKEditor;
从“../../services/forumService”导入ForumpageService;
从“../../controllers/appController”导入appController;
从“../common/Footer”导入页脚;
类ForumReact.Component{
建造师(道具){
超级(道具);
this.deleteReply=this.deleteReply.bind(this);
this.pagination=this.pagination.bind(this);
this.createEditor=this.createEditor.bind(this);
this.destroyEditor=this.destroyEditor.bind(this);
此.state={
主题ID:0,
答复ID:0,
userId:this.props.match.params.userId,
isloggedinuserId:“”,
postDetails:{},
答复数据:[],
答复:'',
errorMsg:“”,
伊斯洛格丁:错,
//编辑状态
编者:错,
}
}
onChange(e){
//log(“用事件信息触发的onChange:”,e);
var newContent=e.editor.getData();
这是我的国家({
答复:新内容
})
//console.log(this.state);
}
异步提交(e){
e、 预防默认值();
if(this.state.reply===''){
this.setState({errorMsg:true})
}否则{
//插入答复
常数数据={
userId:this.state.isloggedinuserId,
答复:this.state.reply,
topicId:this.state.topicId
}
const userReply=等待umpageservice.addReply(数据)
location.href='/repries/'+this.props.match.params.topicid+'/user/'+this.props.match.params.userid+'/'+this.props.match.params.topic_name;
//log(userReply);
}
}
createEditor(ReplyId){
this.setState({showEditor:true})
//控制台日志(e);
如果(!this.state.showEditor){
//创建编辑器实例
CKEDITOR.inline(replyeID);
}
}
destroyEditor(DestroyReplyId){
this.setState({showEditor:false})
//console.log(destroyReplyId);
if(this.state.showEditor){
//保存并销毁编辑器实例
console.log(CKEDITOR.instances[DestroyReplyId].getData());
CKEDITOR.instances[DestroyReplyId].destroy();
}
}
render(){
const repliesData=currentTopics.map((行,索引)=>
{
row.reply_status==0?
{{row.userName}

此答复已被删除。 {'回复:'+Moment.utc(row.created_date).format('YYYY-MM-DD hh:MM A'))

: {{row.userName}

{'回复:'+Moment.utc(row.created_date).format('YYYY-MM-DD hh:MM A'))

{ this.state.showEditor==false ?{this.state.isloggedinuserId==row.reply\u user\u id&&this.state.isLoggedin==true ? :null} :{this.state.isloggedinuserId==row.reply\u user\u id&&this.state.isLoggedin==true ? :null} } {this.state.isloggedinuserId==row.reply\u user\u id&&this.state.isLoggedin==true?:null} } ) 返回( &#回去 {this.state.postDetails.userName} {this.state.postDetails.topic_name} {this.state.postDetails.topic_message}

{'Asked:'+Moment.utc(this.state.postDetails.created_date).format('YYYY-MM-DD hh:MM A'))

{repliesData} ) } }
导出默认Forumreplies您可以存储活动编辑器的行id,而不是存储布尔值:

setState({ activeEditor: row.id }) 
当没有编辑器处于活动状态时,将其设置为
null

然后在
.mapthis.state.activeEditor == row.id