1

I using semantic UI to create a table. I want to set table row property to positive. like this :

<Table.Row positive>

here is my code:

  <Table.Row {this.props.email.success ? "positive" : "negative"}>

but this error is occure :

./src/components/EmailItem.js
Syntax error: ... src/components/EmailItem.js: Unexpected token, expected ... (7:18)

   5 |   render() {
   6 |     return (
>  7 |       <Table.Row {this.props.email.success ? "positive" : "negative"}>
     |                   ^
   8 |         <Table.Cell>
   9 |           {this.props.email.from}
  10 |         </Table.Cell>

how can i fix this ?

1 Answer 1

1

Try this.

<Table.Row positive={!!this.props.email.success} negative={!this.props.email.success}>

And check this - How to conditionally add attributes to React components?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.