---
source: crates/oxc_linter/src/tester.rs
---
  ⚠ 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 │ const Foo = () => (<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:32]
 1 │ const Foo = () => (<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:32]
 1 │ const Foo = () => (<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 │ const Foo = () => (<Item list={arr1.concat(arr2)} />)
   ·                                ─────────────────
   ╰────
  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 │ const Foo = () => (<Item list={arr1.filter(x => x > 0)} />)
   ·                                ───────────────────────
   ╰────
  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 │ const Foo = () => (<Item list={arr1.map(x => x * x)} />)
   ·                                ────────────────────
   ╰────
  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:51]
 1 │ const Foo = () => (<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:68]
 1 │ const Foo = () => (<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:86]
 1 │ const Foo = () => (<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).

  ⚠ 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:25]
 1 │ const Foo = () => { let x = []; return <Item list={x} /> }
   ·                         ┬   ─┬                     ┬
   ·                         │    │                     ╰── And used here
   ·                         │    ╰── And assigned a new value here
   ·                         ╰── The prop was declared here
   ╰────
  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:16]
 1 │ const Foo = ({ x = [] }) => <Item list={x} />
   ·                ┬   ─┬                   ┬
   ·                │    │                   ╰── And used here
   ·                │    ╰── And assigned a new value here
   ·                ╰── The prop was declared here
   ╰────
  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).
