---
source: crates/oxc_linter/src/tester.rs
expression: jsx_no_new_array_as_prop
---
  ⚠ eslint-plugin-react-perf(jsx-no-new-array-as-prop): JSX attribute values should not contain Arrays created in the same scope.
   ╭─[jsx_no_new_array_as_prop.tsx:1:13]
 1 │ <Item list={[]} />
   ·             ──
   ╰────
  help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array).

  ⚠ eslint-plugin-react-perf(jsx-no-new-array-as-prop): JSX attribute values should not contain Arrays created in the same scope.
   ╭─[jsx_no_new_array_as_prop.tsx:1:13]
 1 │ <Item list={new Array()} />
   ·             ───────────
   ╰────
  help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array).

  ⚠ eslint-plugin-react-perf(jsx-no-new-array-as-prop): JSX attribute values should not contain Arrays created in the same scope.
   ╭─[jsx_no_new_array_as_prop.tsx:1:13]
 1 │ <Item list={Array()} />
   ·             ───────
   ╰────
  help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array).

  ⚠ eslint-plugin-react-perf(jsx-no-new-array-as-prop): JSX attribute values should not contain Arrays created in the same scope.
   ╭─[jsx_no_new_array_as_prop.tsx:1:32]
 1 │ <Item list={this.props.list || []} />
   ·                                ──
   ╰────
  help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array).

  ⚠ eslint-plugin-react-perf(jsx-no-new-array-as-prop): JSX attribute values should not contain Arrays created in the same scope.
   ╭─[jsx_no_new_array_as_prop.tsx:1:49]
 1 │ <Item list={this.props.list ? this.props.list : []} />
   ·                                                 ──
   ╰────
  help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array).

  ⚠ eslint-plugin-react-perf(jsx-no-new-array-as-prop): JSX attribute values should not contain Arrays created in the same scope.
   ╭─[jsx_no_new_array_as_prop.tsx:1:67]
 1 │ <Item list={this.props.list || (this.props.arr ? this.props.arr : [])} />
   ·                                                                   ──
   ╰────
  help: simplify props or memoize props in the parent component (https://react.dev/reference/react/memo#my-component-rerenders-when-a-prop-is-an-object-or-array).
