fix(dimentorin): For util React key + backoffice dashboard stats akurat
- For(): bungkus item dalam Fragment dgn key=idx — hilangkan warning 'Each child in a list should have a unique key prop' di semua list backoffice - Dashboard backoffice: fetch per_page=100 (bukan 5/1) supaya stat total akurat; Mentor Terdaftar dihitung dari user list role=Mentor (bukan unique mentor_id dalam 5 sesi pertama)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { Fragment } from 'react'
|
||||
|
||||
export interface ForProps<T, U> {
|
||||
data: readonly T[]
|
||||
children: (item: T, index: number) => U | null
|
||||
@@ -23,5 +25,7 @@ export function For<T, U extends React.JSX.Element>({
|
||||
}: ForProps<T, U>): (U | null)[] | React.ReactNode | null {
|
||||
if (!Array.isArray(data) || !data?.length) return fallback
|
||||
|
||||
return data.map((item, idx) => children(item, idx))
|
||||
return data.map((item, idx) => (
|
||||
<Fragment key={idx}>{children(item, idx)}</Fragment>
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user