我正在尝试创建多行jsx变量
returnedElem = <StyledRemovedAnnotationDiv>
<p>{this.state.deletedAnnotation.objectRemoved.prediction}</p>
<button
className="btn btn-danger"
onClick={() => this.undoDelete(tax, deletedObj)}
>
Undo
</button>
</StyledRemovedAnnotationDiv>,
但这不起作用。请指导我。
答案 0 :(得分:2)
尝试用大括号包装:
returnedElem = (
<StyledRemovedAnnotationDiv>
<p>{this.state.deletedAnnotation.objectRemoved.prediction}</p>
<button
className="btn btn-danger"
onClick={() => this.undoDelete(tax, deletedObj)}
>
Undo
</button>
</StyledRemovedAnnotationDiv>
)
&#13;