以下のようにChildren.count()
を使用することでchildren
の要素の数を数えることができます。
import { Children } from 'react';
function RowList({ children }) {
return (
<>
<h1>Total rows: {Children.count(children)}</h1>
...
</>
);
}
Go to list of users who liked
More than 1 year has passed since last update.
以下のようにChildren.count()
を使用することでchildren
の要素の数を数えることができます。
import { Children } from 'react';
function RowList({ children }) {
return (
<>
<h1>Total rows: {Children.count(children)}</h1>
...
</>
);
}
Register as a new user and use Qiita more conveniently
Go to list of users who liked