Prevent [...] as JSX prop values (jsx-no-new-array-as-prop)
January 7, 2025 ยท View on GitHub
Prevent Arrays that are local to the current method from being used as values of JSX props
Rule Details
The following patterns are considered warnings:
<Item list={[]} />
<Item list={new Array()} />
<Item list={Array()} />
<Item list={this.props.list || []} />
<Item list={this.props.list ? this.props.list : []} />
The following patterns are not considered warnings:
<Item list={this.props.list} />