[英]ReactJS/Semantic-UI print error on table row
I have this part of code from semantic ui in reactjs:我在reactjs中有这部分来自语义ui的代码:
<Table.Row className={bu.state.activeIndex === i ? "title Active": "title"} index={i} onClick={(e) => {bu.Accordion(e, i)}}>
Now I want to set error on this table row:现在我想在这个表行上设置 错误:
<Table.Row error className={bu.state.activeIndex === i ? "title Active": "title"} index={i} onClick={(e) => {bu.Accordion(e, i)}}>
It work fine, but I want to set error with condition:它工作正常,但我想设置错误条件:
<Table.Row {value.deleted === 1 ? 'error': null} className={bu.state.activeIndex === i ? "title Active": "title"} index={i} onClick={(e) => {bu.Accordion(e, i)}}>
But it give me error:但它给了我错误:
Syntax error: Unexpected token, expected "..." (366:37)
语法错误:意外标记,应为“...” (366:37)
How can I solve this?我该如何解决这个问题?
You're putting 'error' as a string but it's a parameter of the Table Row.您将“错误”作为字符串放置,但它是表格行的参数。 You have to set it to true or false.
您必须将其设置为 true 或 false。
<Table.Row
error={value.deleted === 1 ? true : false }
className={bu.state.activeIndex === i ? "title Active": "title"}
index={i}
onClick={(e) => {bu.Accordion(e, i)}}
>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.