raju
raju

Reputation: 6936

Create multiline jsx inside a function

I am trying to create a multiline jsx variable

returnedElem = <StyledRemovedAnnotationDiv>
      <p>{this.state.deletedAnnotation.objectRemoved.prediction}</p>
      <button
        className="btn btn-danger"
        onClick={() => this.undoDelete(tax, deletedObj)}
      >
        Undo
      </button>
    </StyledRemovedAnnotationDiv>,

But this is not working. Please guide me.

Upvotes: 2

Views: 2830

Answers (1)

Karen Grigoryan
Karen Grigoryan

Reputation: 5432

Try wrapping with braces:

returnedElem = (
  <StyledRemovedAnnotationDiv>
      <p>{this.state.deletedAnnotation.objectRemoved.prediction}</p>
      <button
        className="btn btn-danger"
        onClick={() => this.undoDelete(tax, deletedObj)}
      >
        Undo
      </button>
  </StyledRemovedAnnotationDiv>
)

Upvotes: 3

Related Questions