Rules
react/no-children-count

react/no-children-count

Rule category

Restriction.

What it does

Prevents usage of Children.count.

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";
 
function RowList({ children }) {
  return (
    <>
      <h1>Total rows: {Children.count(children)}</h1>
      ...
    </>
  );
}

Further reading