简体   繁体   English

ESLint - 渲染 $ 时出现“react/jsx-one-expression-per-line”错误

[英]ESLint - “react/jsx-one-expression-per-line” error for rendering $

I want to render a dollar in jsx with eslint configured.我想在配置了 eslint 的 jsx 中渲染一美元。 But its not formatting the right way leaves me with this error - {row.revenue} must be placed on a new line ---> react/jsx-one-expression-per-line但它没有以正确的方式格式化给我留下了这个错误 - {row.revenue}必须放在新行上---> react/jsx-one-expression-per-line

example:例子:

 const row = {
    revenue: 234,
  };
  return (
    <div>
      ${row.revenue}
    </div>
  );

I have tried this as well,这个我也试过了

{ '$' }
{row.revenue}

but it's not working.但它不起作用。

Can anyone help me with the right way to format without disabling the rule.任何人都可以在不禁用规则的情况下帮助我以正确的方式格式化。

Try to put $${row.revenue} inside {``} (if i understood you correctly)尝试将 $${row.revenue} 放入 {``} (如果我理解正确的话)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM