【问题标题】:Break the props to next line for a component in react将 props 中断到下一行以获取 react 中的组件
【发布时间】:2021-12-19 05:26:14
【问题描述】:

我正在使用 Prettier 并尝试在保存时格式化并打破我的道具行

<A key={id} image={avatar} username={username} />

当我保存时。

<A 
  key={id} 
  image={avatar} 
  username={username} />

【问题讨论】:

  • 如果一行足够长,会分成多行。

标签: reactjs prettier


【解决方案1】:

我们可以为此使用react/jsx-first-prop-new-line 规则。

参考 - https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md

【讨论】:

  • 如何设置这一切,我是初学者
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-12
  • 1970-01-01
  • 2018-08-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多