Rules
react/no-children-to-array

react/no-children-to-array

Rule category

Restriction.

What it does

Checks usage of React.Children.toArray().

Why is this bad?

Using Children is uncommon and can lead to fragile code. See common alternatives (opens in a new tab).

Examples

❌ Incorrect

import { Children } from "react";
 
export default function ReversedList({ children }) {
  const result = Children.toArray(children);
  result.reverse();
  // ...
}

Further reading