case 'splitWord':
if(this.props.remedStatus){
console.log(this.props.remedStatus)
console.log("remed")
return(
<HotspotRemed
xml={this.receivedXML}
userXml={this.usersAnswerXML}
correctAnswer ={this.ansString}
type={this.splitType}
/>
)
} else {
console.log("reurn word")
return(
<div style ={wrap_style} >
{this.forceUpdate}
<SplitXMLPreview xml={this.receivedXML}
type='w'
assignedSplitContentClick={(contentId, selectionType) => {
this.handleSplitContentClick(contentId, selectionType, 'w')
}}
getCorrectAns={(answers) => {
this.correctAnswers = answers
}}
/>
</div>
)
}
break
<<<==NOW HERE IS MY RENDER MEHTOD.==>>>
render() {
console.log("render")
return (
<div className="previewtemplate" style ={template}>
{this.templateArea(this.state.templateType)}
</div>
);
}
}
我只是想知道如何停止重新渲染组件。
当我单击一个按钮时,我有三个按钮,它在那里执行操作。
有一个按钮。我在其中使用 if else 当我单击该按钮时,它返回 false 和组件 false 调用,这很好,当再次单击该按钮时,它调用 true 组件,这对我来说也很好,但是当我再次单击按钮时首先它调用渲染然后调用我的组件。我不想调用渲染它调用我的组件。
我读了一些他们建议使用 this.forceupdate 的博客。我该怎么办?帮帮我。